Created
September 21, 2020 04:41
-
-
Save hemant-tivlabs/353c0728216d3314bdbd52a8ad378d20 to your computer and use it in GitHub Desktop.
An .htaccess rewrite helper file that helps pass URI fragments as parameters to a single file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<IfModule mod_rewrite.c> | |
RewriteEngine on | |
#RewriteBase / | |
## If the request is for a valid directory | |
RewriteCond %{REQUEST_FILENAME} -d [OR] | |
## If the request is for a valid file | |
RewriteCond %{REQUEST_FILENAME} -f [OR] | |
## If the request is for a valid link | |
RewriteCond %{REQUEST_FILENAME} -l | |
## don't do anything | |
RewriteRule ^ - [L] | |
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)?$ ./index.php?param1=$1¶m2=$2¶m3=$3¶m4=$4 [L,QSA] | |
RewriteRule ^([^/]+)/([^/]+)/([^/]+)?$ ./index.php?param1=$1¶m2=$2¶m3=$3 [L,QSA] | |
RewriteRule ^([^/]+)/([^/]+)?$ ./index.php?param1=$1¶m2=$2 [L,QSA] | |
RewriteRule ^([^/]+)?$ ./index.php?param1=$1 [L,QSA] | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment