Skip to content

Instantly share code, notes, and snippets.

@sajupro
Created April 7, 2020 18:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sajupro/3d7a5c1c71040ceeb489afa4afa70419 to your computer and use it in GitHub Desktop.
Save sajupro/3d7a5c1c71040ceeb489afa4afa70419 to your computer and use it in GitHub Desktop.
Redirect all non-www urls to www with .htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^yourdomain\.com [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment