Created
October 5, 2013 16:39
-
-
Save thetasnippets/6843102 to your computer and use it in GitHub Desktop.
apache: htaccess recipes
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
# 301 redirect one domain to another | |
Options +FollowSymLinks | |
RewriteEngine On | |
RewriteRule ^(.*)$ http://www.__DOMAIN.what__/$1 [R=301] | |
# Nice URLS PHP .htaccess | |
RewriteEngine On | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^(.*)$ $1.php [L,QSA] | |
# http://domain/about -> http://domain/about.php | |
# Redirect index.php Requests | |
# —————————— | |
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC] | |
RewriteCond %{THE_REQUEST} !/system/.* | |
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,L] | |
RewriteCond %{THE_REQUEST} ^GET | |
# Specific custom URLs | |
RewriteEngine on | |
RewriteRule ^foo/$ /pages/foo.html [L] | |
RewriteRule ^bar/$ /bar.php [L] | |
RewriteRule ^qux/$ /qux.html [L] | |
RewriteRule ^quux/$ /pages/quux.htm [L] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment