Skip to content

Instantly share code, notes, and snippets.

@kosmala007
Last active August 17, 2020 10:07
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 kosmala007/1b4c59c6efc0d0db86b8b44f822a8d16 to your computer and use it in GitHub Desktop.
Save kosmala007/1b4c59c6efc0d0db86b8b44f822a8d16 to your computer and use it in GitHub Desktop.
Redirect to non www and https
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# Symfony redirect to public
# RewriteCond %{REQUEST_URI} !^public
# RewriteRule ^(.*)$ public/$1 [L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment