I have an .htaccess file using mod_rewrite to redirect URLs from the old website to the new webpage equivalents. The new site can be viewed at www.eastwood-whelpton.co.uk (which only works in HTML5 browsers right now).
So far, I have got this working by making lots of Redirect Permanent statements to translate each of the old pages to a place in the new site.
This has worked until I’ve needed to create a subdomain for the old website (which I need to keep). Before, it was just in the folder /old/, but Google still crawls it despite not being allowed from Robots.txt. To fix this, I’ve put it in the subdomain ‘old’.
Problem now is, accessing a page such as old.eastwood-whelpton.co.uk/about.htm will still try to redirect to old.eastwood-whelpton.co.uk/about/about.php – which is on the new site.
Here’s a snippet of my HTACCESS file. All I need is to redirect old ‘www’ pages, but not old pages in the ‘old’ subdomain.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^eastwood-whelpton [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
DirectoryIndex index.php
Redirect permanent /index.htm /index.php
Redirect permanent /index.html /index.php
Redirect permanent /yachthire.htm /holidays/sailingholidays.php
Redirect permanent /yachts.htm /about/thefleet.php
Redirect permanent /handover.htm /training/handover.php
Redirect permanent /holiday.htm /holidays/familyholidays.php
First of all,
Redirectis a directive frommod_aliasDo not mix them! Your
Redirectdirective will execute in-spite of WhateverRewriteRuleyou have.Do this instead:
I have changed your
RedirectstoRewriteRuleand tweaked them a bit. Have added,This will not redirect any of your
oldsite URLs.Here is the whole :