Skip to content

Instantly share code, notes, and snippets.

@MostafaNorzade
Created May 24, 2019 10:37
Show Gist options
  • Save MostafaNorzade/8b73d1c5e9b883cb92071955a2148aca to your computer and use it in GitHub Desktop.
Save MostafaNorzade/8b73d1c5e9b883cb92071955a2148aca to your computer and use it in GitHub Desktop.
DirectoryIndex index.php
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^index\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .? - [L]
RewriteRule .? %{ENV:BASE}/index.php [L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment