Last active
March 10, 2022 01:58
-
-
Save tburry/3aef5128b8a25b304f9e to your computer and use it in GitHub Desktop.
.htaccess file for pretty urls that route through index.php
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
# Original | |
# If you modify this file then change the above line to: # Modified | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
# Certain hosts may require the following line. | |
# If vanilla is in a subfolder then you need to specify it after the /. | |
# (ex. You put Vanilla in /forum so change the next line to: RewriteBase /forum) | |
# RewriteBase / | |
# The basic rewrtie rule. | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule ^(.*)$ index.php/$1 [QSA,E=X_REWRITE:1,L] | |
# Add the proper X_REWRITE server variable for rewritten requests. | |
RewriteCond %{ENV:REDIRECT_X_REWRITE} .+ | |
RewriteRule ^index\.php - [QSA,E=X_REWRITE:1,E=!REDIRECT_X_REWRITE,L] | |
# 301 redirect urls that start with request.php | |
RewriteCond %{REQUEST_METHOD} GET [NC] | |
RewriteCond %{REQUEST_URI} ^(.*?)/index\.php(.*)$ | |
RewriteRule ^index\.php %1%2 [QSA,R,L] | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment