Ive got a site siteONE.co.uk
that i want to 301 permanent redirect all the pages to another site, siteTWO.co.uk
For this im currently using the this .htaccess
file below, but im have to type out a new line for each page i want to rediect even though they are all going to the homepage of siteTWO.co.uk
. They are also redirecting incorrectly, instead of siteONE.co.uk/aberdeen
going to siteTWO.co.uk
its going to siteTWO.co.ukaberdeen
(note there is not /
between the .co.uk and aberdeen)
Any ideas were im going wrong with this ?
<Files ~ "^\.(htaccess|htpasswd)$">
deny from all
</Files>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(http://siteONE\.co\.uk)(:80)? [NC]
RewriteRule ^(.*) http://www.siteONE.co.uk/$1 [R=301,L]
order deny,allow
RewriteEngine on
RewriteRule ^/?$ http://siteTWO.co.uk/ [R=301,L]
redirect 301 / http://siteTWO.co.uk
redirect 301 /aberdeen http://siteTWO.co.uk
redirect 301 /bath http://siteTWO.co.uk
redirect 301 /belfast http://siteTWO.co.uk
redirect 301 /birmingham http://siteTWO.co.uk
redirect 301 /cambridge http://siteTWO.co.uk
redirect 301 /canterbury http://siteTWO.co.uk
redirect 301 /chester http://siteTWO.co.uk
redirect 301 /york http://siteTWO.co.uk
You can get rid of all the code in your .htaccess and use this rule instead:
RewriteEngine on
RewriteRule ^ http://siteTWO.co.uk/? [R=301,L,NE]
Make sure to clear your browser cache before testing this.