htaccess cheat sheet

1. Rewrite All URLs on one domain to new domain

Put the following code in the .htaccess file of your old domain

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]

2. Rewrite non-www urls with www

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

Popularity: 13% [?]

This entry was posted in SEO, URL Rewriting and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *