Adam Howard
Well-known member
So for my own use, I'm trying to make my htaccess as generic as possible (so I don't have to maintain more than one)
I got the above from here
http://stackoverflow.com/questions/4916222/htaccess-how-to-force-www-in-a-generic-way
This forwards non-www to www.
The advantage is I don't have to actually supply the domain name. Thus it works everywhere (cool, eh?).
What I'd like is away to reverse it ... ie... force www to non-www.
PHP:
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
I got the above from here
http://stackoverflow.com/questions/4916222/htaccess-how-to-force-www-in-a-generic-way
This forwards non-www to www.
The advantage is I don't have to actually supply the domain name. Thus it works everywhere (cool, eh?).
What I'd like is away to reverse it ... ie... force www to non-www.