Last active
September 9, 2015 15:52
-
-
Save benhuson/9388424 to your computer and use it in GitHub Desktop.
.htaccess examples
This file contains hidden or 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
| # Redirect to fully qualified domain if different | |
| <IfModule mod_rewrite.c> | |
| RewriteEngine On | |
| RewriteCond %{HTTP_HOST} !^www.example.com | |
| RewriteRule (.*) http://www.example.com%{REQUEST_URI} | |
| </IfModule> | |
| # Only allow specific IPs for testing | |
| <Limit GET POST> | |
| order deny,allow | |
| deny from all | |
| allow from 000.000.000.001 | |
| allow from 000.000.000.002 | |
| </Limit> | |
| # Deny direct access to files | |
| <Files .htaccess,.svn,debug.log> | |
| order allow,deny | |
| deny from all | |
| </Files> | |
| # Redirect all old file to home ignoring some folders | |
| RewriteEngine On | |
| RewriteBase / | |
| RewriteCond %{REQUEST_URI} !^/images/ | |
| RewriteCond %{REQUEST_URI} !^/css/ | |
| RewriteCond %{REQUEST_URI} !^/js/ | |
| RewriteRule ^([^/]+)(.*)$ / [R] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment