I have a multi domain site, meaning multiple domains are pointing to my server.
The common way people say to enforce no www in a site’s URL is usually something like this:
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^(.*)$ http://example.com/$1 [R=301]
However, this code relies on the domain being example.com Is there a way to make it work for any domain?
Try this to make it work for any domain. It just replaces the
example.comwith a liberal match(.+)and substitutes it in theRewriteRule: