To Move a single page
Redirect 301 /oldpage.html http://www.example.com/newpage.html
To Move an entire site
Redirect 301 / http://www.example.com/
Change file extension
RedirectMatch 301 (.*)\.html$ http://www.example.com$1.php
Redirect www to non www version of site
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^example\.com
RewriteRule (.*) http://example.com/$1 [R=301,L]
Redirect non-www to www
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^yoursite.com [NC]
RewriteRule ^(.*)$ http://www.yoursite.com/$1 [L,R=301]
Redirect example.com/index.php to example.com/
Options +FollowSymLinks
RewriteEngine on
# index.php to /
RewriteCond %{THE_REQUEST} ^[A-Z]{3, 9}\ /.*index\.php\ HTTP/
RewriteRule ^(.*)index\.php$ /$1 [R=301,L]



Leave a Reply
You must be logged in to post a comment.