Forum Moderators: phranque

Message Too Old, No Replies

New Domain Rewrite .htaccess

New Domain Rewrite .htaccess

         

solokron

4:07 am on Feb 11, 2007 (gmt 0)

10+ Year Member



I am a bit confused how to perform this .htaccess rule.
I have setup a 302 redirect for a domain to forward to its new domain. I am interested in setting up a all but this directory rule.

Currently I have set in my .htaccess:

Redirect 302 / [newdomain.com...]

What I would like to do is that but make an exception where as

[olddomain.com...]

remains and is not forwarded. Any ideas?

Thanks!

solokron

10:17 am on Feb 11, 2007 (gmt 0)

10+ Year Member



Figured it out.

RewriteEngine on
RewriteCond $1!^resources
RewriteRule (.*) [newdomain.com...] [R=302,L]

LunaC

1:30 pm on Feb 11, 2007 (gmt 0)

10+ Year Member



Is the new domain just a temporary location? ie. you intend to put the content back to the old domain at some point?

If not you will want to use a 301 (permanent redirect) not a 302 (temporary) since most search engines will continue to index the old url, not the new one with a 302 in place.