Created
August 16, 2012 09:49
-
-
Save rumkin/3368954 to your computer and use it in GitHub Desktop.
Apache general redirects
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
# Redirect from index | |
RewriteCond %{QUERY_STRING} ^$ [OR] | |
RewriteCond %{REQUEST_FILENAME} ^\/index$ | |
RewriteRule ^index$ http://host.tld/ [NC,R=301,L] | |
# Redirect everythink to php | |
RewriteCond %{QUERY_STRING} ^(.*)$ | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^([a-zA-Z_][a-zA-Z0-9_\-\[\]\/\.]+)$ /?%1&path=$1 [NC,L] | |
# Redirect www.host.tld to host.tld | |
Options +FollowSymLinks | |
RewriteCond %{HTTP_HOST} ^www\.host\.tld$ [NC] | |
RewriteRule ^(.*)$ http://host.tld/$1 [R=301,L] | |
# Redirect images to image resizer, example: file.jpg?i200x100 | |
RewriteCond %{QUERY_STRING} ^(i|o)\d+(x\d+)?$ | |
RewriteCond %{REQUEST_FILENAME} -f | |
RewriteRule ^(.*\.(jpg|jpeg|png))$ ?__uri__=/.image-resizer&image=$1 [QSA,NC,L] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment