|
-
Oct 23rd, 2007, 08:56 AM
#1
Thread Starter
Frenzied Member
.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
If I have been helpful please rate my post. If I haven't tell me!
-
Oct 23rd, 2007, 10:10 AM
#2
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.).
Last edited by penagate; Oct 23rd, 2007 at 10:13 AM.
-
Oct 23rd, 2007, 10:24 AM
#3
Thread Starter
Frenzied Member
Re: .htaccess redirects
Great works perfectly - thanks for all your help!
If I have been helpful please rate my post. If I haven't tell me!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|