No “www” – htaccess redirect

I go just long enough between websites that I’m always forgetting this little number. Putting it here so I can just grab it next time.

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^example\.com$ [NC]
RewriteRule ^(.*)$ https://example.com/$1 [L,R=301]

“pedestrian diversion” by Graham Richardson is licensed under CC BY 2.0

Leave a Reply