|
#1
| ||||
| ||||
| htaccess redirect question?? I want to redirect an alternative url to a folder in a subdomain of my main site. Example: Somebody types: www.productname.com I want to redirect them to: www.products.maindomain.com/product_01 If possible, I would like this to be masked, so the url in the address bar would still show: www.productname.com. Can anybody help? |
|
#2
| |||
| |||
| You probably want to do frame forwarding not a redirect. Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> <html> <head> <title>hello</title> <meta name="keywords" content="hello" /> <meta name="description" content="hello" /> </head> <frameset rows="100%"> <frame src="http://yoursite.com/thedesiredpage" title="hello" frameborder="0" noresize="noresize"/> <noframes> <body> <h1>hello</h1> <p><a href="http://yoursite/thedesiredpage">http://yoursite.com/</a></p> </body> </noframes> </frameset> </html> |
|
#3
| ||||
| ||||
| Thanks, but I already know how to do it in HTML (and at nameserver, dns level, etc,). It's the htaccess that I'm interested in knowing about. If the masking makes it too complicated, can you break it down into redirect and then the masking? It's the redirect that I'm most interested in..... Somebody types: www.productname.com I want to redirect them to: www.products.maindomain.com/product_01 |
|
#4
| ||||
| ||||
| Code: Redirect 301 / www.products.maindomain.com/product_01
__________________ MacBook Pro 2.16GHz Core2Duo 3GB RAM, G4 1.4GHz OSX Tiger 1.25GB RAM, Dual 2GHz G5 OSX Tiger 2GB RAM (freakin shweet) Athlon 64 Windoze XP for school work (programming) 1GB RAM dferns@macosx.com |
|
#5
| ||||
| ||||
| Thanks, but I'm a bit confused. Does this require something additional? How does the browser distinguish between the main domain and the sub-domain? I still want all traffic for maindomain.com to reach the maindomain. Surely this will redirect ALL traffic to www.products.maindomain.com/product_01 and completely bypass maindomain.com? I've tried the following but neither seem to work... Redirect 301 productname.com http://productname.maindomain.com Redirect 301 productname.com http://www.products.maindomain.com/product_01 Either would be acceptable for now. Thanks |
|
#6
| ||||
| ||||
| This is on the server so the browser doesn't care. It'll receive the http 301 code which says redirect to this other URL. You would put this .htaccess file in your html root for that domain and you have to have htaccess files enabled in your httpd.conf apache config file.
__________________ MacBook Pro 2.16GHz Core2Duo 3GB RAM, G4 1.4GHz OSX Tiger 1.25GB RAM, Dual 2GHz G5 OSX Tiger 2GB RAM (freakin shweet) Athlon 64 Windoze XP for school work (programming) 1GB RAM dferns@macosx.com |
|
#7
| ||||
| ||||
| The httpd.conf is set up correctly. The root for the alternative domain is also the root for the main domain (as far as the DNS is concerned), so because it's the main root, when I add ... Redirect 301 / www.products.maindomain.com/product_01 ... everything redirects (including maindomain.com). Can we use a simpler example while I get my head around the issue: newdomain.com -> newdomain.maindomain.com I thought this would be: Redirect 301 newdomain.com http://newdomain.maindomain.com but that doesn't work!? Thanks for you patience |
![]() |
| Thread Tools | |
|
|