Skip to content

Instantly share code, notes, and snippets.

@akanik
Created February 2, 2016 20:34
Show Gist options
  • Save akanik/f4b7351ce3636675f5df to your computer and use it in GitHub Desktop.
Save akanik/f4b7351ce3636675f5df to your computer and use it in GitHub Desktop.
htaccess redirect naked domain
# To redirect all users to access the site WITH the 'www.' prefix,
# (http://example.com/... will be redirected to http://www.example.com/...)
# Make sure to replace example.com with your own site name
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment