DustyReagan/trim-framework/master/www/.htaccess - Htaccess File

DustyReagan/trim-framework/master/www/.htaccess

###
# Geting the htaccess file to redirect to the proper index.php file regaurdless of the user's installation directory
# is tricky business. Thanks to Michael Heim for figuring it out!
# http://www.zeilenwechsel.de/it/articles/8/Using-mod_rewrite-in-.htaccess-files-without-knowing-the-RewriteBase.html
###

### turn mod_rewrite engine on.
RewriteEngine On

### set the RewriteBase for consistancy
RewriteBase /

### if the is not a request for an existing file or directory
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
### and the URI DOES end with a slash
RewriteCond %{REQUEST_URI} (.*)/$
### redirect the request to index.php in *this* directory
RewriteCond $0#%{REQUEST_URI} ([^#]*)#(.*)1$
RewriteRule ^.*$ %2index.php [QSA,L]

### if the is not a request for an existing file or directory
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
### and the URI does NOT end with a slash
RewriteCond %{REQUEST_URI} !(.*)/$
### redirect and add the slash.
RewriteCond $0#%{REQUEST_URI} ([^#]*)#(.*)1$
RewriteRule ^(.*)$ %2$1/ [QSA,L,R=301]

On Github License

Files

Download PDF of Htaccess file
REQUEST_FILENAME, REQUEST_URI

Comments

Apache