Q:

Maintenance mode doesn't work on front page without www prefix

I have my site in sub directory and it works both with and without www prefix but when I place it in maintenance mode I've noticed it doesn't work for the front page without www prefix until you either try log in or go to another linked page. 
Is there anyway I can fix it so it works on that front page when no www prefix? 

A:

Add this to your .htaccess file:
RewriteEngine On
RewriteCond %{HTTP_HOST} ! ^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

(Per this tutorial)

