Skip to content

Instantly share code, notes, and snippets.

@jayarjo
Last active December 12, 2015 05:19
Show Gist options
  • Save jayarjo/4721061 to your computer and use it in GitHub Desktop.
Save jayarjo/4721061 to your computer and use it in GitHub Desktop.
redirect non-www to www
# ignore specific path (/administrator/ - in this case)
RewriteCond %{REQUEST_URI} ^/?administrator($|\/|\/.*) [NC]
RewriteRule ^.*$ - [NC,L]
# redirect non-www to www
RewriteCond %{HTTP_HOST} ^yoursite\.com [NC]
RewriteRule ^(.*)$ http://www.yoursite.com/$1 [R=301,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment