Generic htaccess redirect www to non-www
I would like to redirect www.example.com to example.com. The following htaccess code makes this happen:
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
But, is there a way to do this in a generic fashion without hard coding the domain name?
Discover more from Muft Shiksha™ | मुफ्त शिक्षा
Subscribe to get the latest posts sent to your email.
Akbar Khan Answered question 5 Apr, 2024
Discover more from Muft Shiksha™ | मुफ्त शिक्षा
Subscribe to get the latest posts sent to your email.
Akbar Khan Answered question 5 Apr, 2024