Since everything on page one of google isn’t, well, perfect, here’s a fully working example where you don’t need to type in your silly domain name.
# redirect all non-www traffic
RewriteCond %{HTTP_HOST} ^([a-zA-Z0-9\-]*)\.com$
RewriteRule ^.*$ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
For the unknowing, this code uses mod_rewrite.

No Responses to "Redirect Non-WWW Requests to WWW"
Leave A Reply