I have a site with URLs like this:
http://domain.co.uk/subdir/page.php
I have redesigned the site so URLs are now like this:
http://domain.co.uk/page.php
How can I 301 redirect all the pages to their new locations using Apache's mod_rewrite?
I have a site with URLs like this:
http://domain.co.uk/subdir/page.php
I have redesigned the site so URLs are now like this:
http://domain.co.uk/page.php
How can I 301 redirect all the pages to their new locations using Apache's mod_rewrite?
Something like this should do the trick, I believe:
RewriteRule ^subdir/(.*)$ http://domain.co.uk/$1 [R=301,QSA,L]
This should do the trick:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^subdir/(.*)$ http://domain.co.uk/$1 [R=301,L]
</IfModule>
Update: Tested it, it works.