I am using a version of the Focus Labs Master Config setup and I am getting a database error when using the www. prefix in front of the URL. This is a problem that I haven't run into before. Anyone have any thoughts?

You can see the issue at http://denvillechamber.com. Obviously add the www prefix to recreate the error.

1 Answer 1


This is because the master config changes database configurations based on the value of $_SERVER['HTTP_HOST'], and you likely have "denvillechamber.com" as your value, which is not the same as "www.denvillechamber.com".

Your site should not be accessible at both www and non-www locations - one should redirect to the other.

Put this in your .htaccess file:

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

Should fix your problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.