Learn more about our packages and pricingLearn more about our packages and pricing

Add www. to your domain automatically with htaccess

April 8th, 2008

Looking for an easy way to make sure that visitors always see www.yourdomain.com instead of yourdomain.com? It’s simple if you’re hosting on a server that can handle .htaccess files. Take a look at the code below:

RewriteEngine on
Options FollowSymlinks
rewritecond %{http_host} ^ageedesign.com [nc]
rewriterule ^(.*)$ http://www.ageedesign.com/$1 [r=301,nc]

Using this code anytime a visitor visits any page on your website, the URL will be automatically updated to include the www. Simply copy/paste this code into a file called .htaccess and save it at the root level of your website and upload it and you should be in business! For more information on htaccess and MOD Rewrite check out this article.

del.icio.us Slashdot Digg Facebook Technorati StumbleUpon

Leave a Reply

You must be logged in to post a comment.