I have the following two mod_rewrite redirects. They both appear to do the same thing, but I’m not sure why one is two lines longer than the other. (I’ve been using the longer one btw):
1:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
RewriteRule ^$ shows [L]
2:
RewriteEngine On
RewriteRule ^$ /shows [L]
The extra two lines simply forward requests for any page at
example.comto the same page atwww.example.com, performing a 301 permanent redirect (hence theR=301...).It’s good practice not to have duplicate content on two domains (for SEO purposes) so most people these days forward
example.comtowww.example.com; the other way around is also perfectly valid and quite widely used (ie. redirectingwww.example.comtoexample.com).