-
.htaccess redirects
I've added the following into my .htaccess
Code:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^oldurl.com [NC]
RewriteRule ^(.*)$ http://www.newurl.com/$1 [L,R=301]
Where I want to redirect all pages from the old domain to the new domain e.g. www.oldurl.com/example.htm should redirect to www.newurl.com/example.htm
However nothing happens! Is there any syntax wrong?
Is it possible for me to find out if the rewrite engine is turned on - host says it is!
Cheers
DJ
-
Re: .htaccess redirects
www.oldurl.com is not the same as oldurl.com.
The easiest way is to negate the expression:
Code:
RewriteCond %{HTTP_HOST} !^([a-z\.]+\.)?newurl.com$
RewriteRule ^(.*)$ http://www.newurl.com/$1 [L,R=301]
That should match any domains that are not newurl.com or a subdomain of it (or sub-subdomain, etc.).
-
Re: .htaccess redirects
Great works perfectly - thanks for all your help!