Skip to content

Instantly share code, notes, and snippets.

@lshaf
Created April 10, 2020 03:19
Show Gist options
  • Save lshaf/478435e6abc60e9ac79e1601ae90c1cd to your computer and use it in GitHub Desktop.
Save lshaf/478435e6abc60e9ac79e1601ae90c1cd to your computer and use it in GitHub Desktop.
RewriteEngine on
# Option 1: To rewrite "www.domain.com -> domain.com" uncomment the following lines.
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment