- Impact
- 417
For consistently changing URL's with www to no www I've seen people suggest these formats for .htaccess:
I have one in mind which "seems to work better with at least one host", and I'm interested in knowing which one you think is better, and why?
Thank you.
>>> EDIT: The main point is avoiding conflicts with scripts in sub-directories. <<<
Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^example\.com$ [NC]
RewriteRule .? http://example.com%{REQUEST_URI} [R=301,L]
Code:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^example.com$ [NC]
RewriteRule ^(.*)$ http://example.com$1 [L,R=301]
I have one in mind which "seems to work better with at least one host", and I'm interested in knowing which one you think is better, and why?
Thank you.
>>> EDIT: The main point is avoiding conflicts with scripts in sub-directories. <<<
Last edited:










