Forum Topic: require www

Forum: .htaccess Forum : Basics • Posted by don289 • Updated:


I’m using an online store prebuilt using PHP and it comes along with an .htaccess and everything is working fine until I add this directive:

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

After adding the above directive my live website turned into something like a website without CSS or missing CSS. I have removed the above directives and everything went normal.

I wonder what happen?

2 Replies to “require www”

Posted by Jeff Starr

It sounds like the CSS file may be located on a different domain..? I would examine the source code of your web page(s) and see what happens when the code is in place.. try clicking on the link to the stylesheet and see what happens (or doesn’t)..

Posted by don289 •

Thanks for the insight it will help me a lot figure out what went wrong. The CSS file is located on the same domain name. I’m also asking the web hosting company how their server work with the above directive, I’m waiting for their answer.