How do I redirect a non www address to a www address?
In my case, I built a Flash site with SWFAddress to allow deeplinking. The downside to this was the site didn’t work well if a user used a URL like exaple.com instead of www.example.com.
If your site runs on an Apache server, you can use .htaccess to redirect all users visiting a example.com URL (without the www) to a www.example.com URL (with the www). This is the code you need:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
Put it in a file named .htaccess, upload it to the root directory of your website, and your good to go.
Link:
www.stepforth.com/resources/web-marketing-knowledgebase/non-www-redirect
Leave a Reply