Skip to content

Instantly share code, notes, and snippets.

@w-jerome
Created November 7, 2019 10:02
Show Gist options
  • Save w-jerome/558223b0fc739839a205eb44d58ccd4d to your computer and use it in GitHub Desktop.
Save w-jerome/558223b0fc739839a205eb44d58ccd4d to your computer and use it in GitHub Desktop.
Htaccess - Basic config
# Pass the default character set
AddDefaultCharset utf-8
# BEGIN Rewrite rules
RewriteEngine On
RewriteBase /
# Redirection www
RewriteCond %{HTTP_HOST} ^site\.com$ [NC]
RewriteRule ^(.*)$ https://www.site.com/$1 [R=301,L]
# Redirect https
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.site\.com
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
# Rewrite URL
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment