Skip to content

Instantly share code, notes, and snippets.

@RoesWibowo
Created August 15, 2016 07:57
Show Gist options
  • Save RoesWibowo/99f723de31972240cf85ad405a467c60 to your computer and use it in GitHub Desktop.
Save RoesWibowo/99f723de31972240cf85ad405a467c60 to your computer and use it in GitHub Desktop.
Redirect www to non www
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect www to non www
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment