I'm kind of a noob when it comes to htaccess and mod_rewrite, so anyone who can point me in the right direction will be very much appreciated.
I have recently changed a site address and I need the old address to redirect to the new. I have no problem with that. However, some of the directory structures on the old site are completely different (the new site uses Wordpress) and I need everything from the old site that DOESN'T EXIST on the new site to go straight to the new site's front page.
So far I have:
- Code: Select all
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^old-domain\.com/$
RewriteRule (.*) http://new-domain.co.uk/$1 [R=301,L]
RewriteCond %{HTTP_HOST} !^www\.ld-domain\.com/$
RewriteRule (.*) http://new-domain.co.uk/$1 [R=301,L]
redirect 301 / http://new-domain.co.uk
WHich will work on anything except any file that begins with "www.". However the old domain written in directly (http://www.old-domain.com) will redirect but http://www.old-domain.com/somedirectory/somefile.asp WON'T, even though http://old-domain.com/somedirectory/somefile.asp WILL.
Any one have any ideas?
Thank you in advance
Michael