Take the 2-minute tour ×
ExpressionEngine® Answers is a question and answer site for administrators, end users, developers and designers for ExpressionEngine® CMS. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

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.

share|improve this answer
add comment

Your Answer

 
discard

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

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