Skip to content

Instantly share code, notes, and snippets.

@avtobys
Last active October 24, 2022 19:40
Show Gist options
  • Save avtobys/2367c47aa1cfe5eb459a924add2ccd3c to your computer and use it in GitHub Desktop.
Save avtobys/2367c47aa1cfe5eb459a924add2ccd3c to your computer and use it in GitHub Desktop.
htaccess non slashes
DirectoryIndex index.php
AddDefaultCharset UTF-8
Options -Indexes
<ifModule mod_headers.c>
<FilesMatch ".(flv|gif|jpg|jpeg|png|ico|swf|js|css|pdf)$">
Header set Cache-Control "max-age=2592000"
</FilesMatch>
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule .* %{REQUEST_SCHEME}://%{SERVER_NAME}%1 [R=301,L]
RewriteCond %{THE_REQUEST} //
RewriteRule .* %{REQUEST_SCHEME}://%{SERVER_NAME}/$0 [R=301,L]
RewriteCond %{REQUEST_URI} ^(.+)/index\.(php|html)
RewriteRule ^(.+)/index\.(php|html)([^/]*)$ %{REQUEST_SCHEME}://%{SERVER_NAME}/$1 [R=301,L]
RewriteCond %{THE_REQUEST} /index\.(php|html)
RewriteRule ^index\.(php|html)([^/]*)$ %{REQUEST_SCHEME}://%{SERVER_NAME}/ [R=301,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . /index.php [L]
RewriteCond %{REQUEST_URI} ^(.+)\.php
RewriteRule . /index.php [L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment