Dynadot โ€” .com Registration $8.99

The Ultimate .htaccess Smackdown

Spacemail by SpaceshipSpacemail by Spaceship
Watch
For consistently changing URL's with www to no www I've seen people suggest these formats for .htaccess:

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:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
Dynadot โ€” .com Registration $8.99Dynadot โ€” .com Registration $8.99
Appraise.net
Unstoppable Domains
Domain Recover
DomainEasy โ€” Zero Commission
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back