Review Hell Blog

This is where I post site news, tips and tricks, and special web hosting offers. Make sure you subscribe!

Subscribe to Updates

Get the latest Review Hell news, blog updates, and special offers in your inbox. No spam, promise!

Redirecting non-www to www through .htaccess

image

I get this question a lot, so I’m now writing this post to use as a reference. Here’s how to redirect yourdomain.com to www.yourdomain.com.

Step 1: Open Notepad or your favorite text editor and paste the following code:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain\.com [NC]
RewriteRule ^(.*) http://www.yourdomain.com/$1 [L,R=301]

Step 2: Save the file as “.htaccess”

Take note that it’s not supposed to be “htaccess.txt,” or any other file name with another extension. It’s just “.htaccess”

Step 3: Upload the .htaccess file to your website’s directory. Your site should now be redirecting all yourdomain.com requests/visits to www.yourdomain.com.

Share this post!

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.