Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Anyone know why my homepage won't load with the www prefix.

Links such as


will load fine



returns a 404.

Every page works including the home page if I leave out the www. The site has CMS Made Simple in the backend and has a root_url set without the www. The DNS has a CNAME to the www too.

As Requested here is the .htaccess:

RewriteEngine On

RewriteRule ^gallery(/((([a-zA-Z0-9-]+)(/(\d+))?)/?)?)?$ index.php?page=77&groupId=$4&showpage=$6 [NC,QSA,L]

RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+)$ index.php?page=$1 [NC,QSA,L]
share|improve this question

migrated from stackoverflow.com Nov 8 '11 at 22:21

This question came from our site for professional and enthusiast programmers.

Can you post the contents of your .htaccess? Otherwise it's entirely speculation... – ianhales Oct 14 '11 at 15:27
added it in the question thanks. – jiraiya Oct 14 '11 at 15:31
Could this be it?: "...has a root_url set without the www" – Sparky Oct 14 '11 at 15:32
It depends on the 404 generated. If it's handled by the CMS and outputted accordingly, then that's a likely possibility. If it's a raw server 404, then the CMS settings shouldn't make any difference. – ianhales Oct 14 '11 at 15:36
@jiraiya, you should post the final outcome as an answer and accept your own answer. – Sparky Nov 8 '11 at 4:02

Might it be the fact that you have a last rewrite flag on the first rule? I would remove the L from [NC, QSA, L].

RewriteRule ^gallery(/((([a-zA-Z0-9-]+)(/(\d+))?)/?)?)?$ index.php?page=77&groupId=$4&showpage=$6 [NC,QSA,L]

I believe the L flag will stop the rules below from being parsed, may be wrong though? We have any .htaccess wiz's out there?

share|improve this answer
That rule would only apply to gallery pages, and the L flag only stops mod_rewrite if the rule matches. So it's not the problem. The problem was a DNS propagation error as specified in the comments. The OP just chose not to post that solution and accept it as an answer. – Lèse majesté Dec 8 '11 at 23:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.