Setting up a new site today, I ran into a problem with a .htaccess not working.

It was a pretty simple solution, and was the result of a minor oversight my part.

Still, it took me about 10 minutes to realize the mistake I’d made.

I just thought I’d post here in case someone else makes the same mistake.

I searched for a while but didn’t find the answer… until it finally dawned on me, “duh, I forgot to include the RewriteEngine on directive!”

So, I had this:

Options -Indexes


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

But should have had this:

Options -Indexes


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

Forgetting that simple line, “RewriteEngine on”, caused me all kinds of headache. :)