Skip to content

Instantly share code, notes, and snippets.

@shanedroid
Created March 4, 2014 19:52
Show Gist options
  • Save shanedroid/9354251 to your computer and use it in GitHub Desktop.
Save shanedroid/9354251 to your computer and use it in GitHub Desktop.
.htaccess TEMPLATE
/* HTACCESS TEMPLATE - USE FOR STUFFS */
### Disable Directory Lsiting ###
#Options All -Indexes
### Domain redirects ###
#RewriteEngine on
#RewriteCond %{HTTP_HOST} ^mysite.com
#RewriteRule (.*) http://www.yoursite.com/$1 [R=301,L]
### Custom Errors ###
#Options -Indexes
#Options +FollowSymLinks
#RewriteEngine On
#ErrorDocument 400 http://www.mysite.com/error1.<wbr>html
#ErrorDocument 401 http://www.mysite.com/error2.<wbr>html
#ErrorDocument 404 http://www.mysite.com/error3.<wbr>html
#ErrorDocument 500 http://www.mysite.com/error4.<wbr>html
### Handling Dynamic URL --> Make Static ###
#Options -Indexes
#Options +FollowSymLinks
#RewriteEngine On
#RewriteRule (.*)\.html$ page.php?id=$1
### Remove .php from URL ###
#RewriteEngine On
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteRule ^([^\.]+)$ $1.php [NC,L]
### Remove .html from URL ###
#RewriteEngine On
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteRule ^([^\.]+)$ $1.html [NC,L]
### Remove .php and also add a slash to name / ###
#may need to add multiview in order for this to work must test!#
#Options -MultiViews
#RewriteEngine On
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteRule ^([^/]+)/$ $1.php
#RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
#RewriteRule (.*)$ /$1/ [R=301,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment