Created
November 28, 2014 18:08
-
-
Save tuxfight3r/838dbc4b1464615a016c to your computer and use it in GitHub Desktop.
apache vhost url redirection tricks
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 NonSSL to SSL | |
RewriteEngine on | |
RewriteCond %{HTTPS} off | |
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] | |
#Redirect if the host name not begins with WWW | |
RewriteEngine on | |
RewriteCond %{HTTP_HOST} !^www.nerdplanet.co.uk$ [NC] | |
RewriteRule ^(.*)$ https://www.nerdplanet.co.uk$1 [R=301] | |
#Redirect if the request uri deosnt end with a / | |
RewriteEngine On | |
RewriteCond %{REQUEST_URI} !(/$|\.) | |
RewriteRule (.*) %{REQUEST_URI}/ [R=301] | |
#Apache redirects | |
Redirect permanent /test http://test.nerdplanet.co.uk/~test/ | |
Redirect temp /test http://test.nerdplanet.co.uk/~test/ | |
Redirect seeother /test http://test.nerdplanet.co.uk/~test/ | |
Redirect gone /test | |
(OR) | |
Redirect 301 /test http://test.nerdplanet.co.uk/~test/ | |
Redirect 302 /test http://test.nerdplanet.co.uk/~test/ | |
Redirect 303 /test http://test.nerdplanet.co.uk/~test/ | |
Redirect 410 /test | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment