|
Redirect relocated urls with mod rewrite
|
(Page 3 of 6)
Sometimes you need to relocate your pages, but you want to
recapture PageRank/link popularity, ranking, and retain visitors who might be lost by an unexpected 404 (Not Found) error code.
The only way to save your rankings and visitors is to redirect the old urls to the new urls.
RewriteEngine On
# Redirect relocated urls to the new direction
RewriteRule ^oldpage\.html$ http://www.example.com/newpage.html [R=301,L]
RewriteRule ^directory/oldpage\.html$ http://www.example.com/directory/newpage.html [R=301,L]
When you need to relocate a directory and all the files in it to a new directory.
# Redirect relocated directories to the new directories
RewriteRule ^olddir/(.*) http://www.example.com/newdir/$1 [R=301,L]
NEXT » Redirect non existing inbound links with mod rewrite
|
|
|