Last active
June 15, 2020 09:22
-
-
Save jvanja/3975925 to your computer and use it in GitHub Desktop.
Rewrite rule for .htaccess for rewritting /page/subpage to ?page=page&subpage=subpage
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
# redirects for url params | |
RewriteEngine On | |
RewriteRule ^([a-zA-Z0-9-z\-\_]+)$ index.php?page=$1 | |
RewriteRule ^([a-zA-Z0-9-z\-\_]+)/$ index.php?page=$1 | |
RewriteRule ^([a-zA-Z0-9-z\-\_]+)/([a-zA-Z0-9-z\-\_]+)$ index.php?page=$1&subpage=$2 | |
RewriteRule ^([a-zA-Z0-9-z\-\_]+)/([a-zA-Z0-9-z\-\_]+)/$ index.php?page=$1&subpage=$2 | |
# index file priority | |
DirectoryIndex index.html index.htm index.php welcome.html | |
# forbid file listing for root and subdirectories | |
Options All -Indexes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment