Forum Moderators: phranque

Message Too Old, No Replies

redirect with subdomain/pointed domains

redirect /file.htm redirects files named file.htm in subdomain too

         

nick77

9:36 pm on Jan 30, 2006 (gmt 0)

10+ Year Member



Hi everybody

I have moved around a couple of things on my server and I'm now having quite a lot of redirects;-)

They work perfectly and look like this:


Redirect permanent /site1.html http://domain.com/new_location/site1.html

I have a shared hosting plan running on freebsd, and could have setup a additional domain pointing to a subdomain of the main server. Now, all sites named site1.html on this additional domain name (a completely independent site!) are being redirected to the domain specified above which isn't really a desired effect....

It doesn't seem to be enough to just put a .htaccess file without these commands into the subdomain folder - the file keeps being redirected:(

Is there a way to "switch off" redirects being executed as defined in the .htaccess in the doc_root folder?

Any help greatly appreciated! Thanks

Nick

[edited by: jdMorgan at 10:43 pm (utc) on Jan. 30, 2006]
[edit reason] De-linked. [/edit]

jdMorgan

10:42 pm on Jan 30, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Nick,

Welcome to WebmasterWorld!

You'll need to use a similar construct in mod_rewrite to selectively redirect based on the requested hostname (domain):


RewriteCond %{HTTP_HOST} ^(www\.)?domain_to_be_redirected\.com
RewriteRule ^site1\.html$ http://domain.com/new_location/site1.html [R=301,L]

mod_alias has no provisions for doing such conditional redirects.

For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].

Jim

nick77

10:59 am on Feb 2, 2006 (gmt 0)

10+ Year Member



thank you, Jim!

I always was a little scared using the mod_rewrite feature:

`The great thing about mod_rewrite is it gives you all the configurability and flexibility of Sendmail. The downside to mod_rewrite is that it gives you all the configurability and flexibility of Sendmail.''

But I'll definitively have a look into it. Probably it'll be easier to solve than I think;-)

Cheers

Nick

nick77

7:28 pm on Feb 2, 2006 (gmt 0)

10+ Year Member



Jim, this ist G*R*E*A*T! It works perfectly!

I've done all kind of dirty and ugly things to avoid using mod_rewrite much too long; I can't wait to use it on all my servers now;-)

Nick