Difference between revisions of "Htaccess"
From KOP KB
Line 1: | Line 1: | ||
− | Redirect for SSL | + | == Redirect for SSL == |
<syntaxhighlight lang="apache"> | <syntaxhighlight lang="apache"> | ||
Line 7: | Line 7: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | Another SSL redirect option | + | == Another SSL redirect option == |
<syntaxhighlight lang="apache"> | <syntaxhighlight lang="apache"> | ||
RewriteEngine On | RewriteEngine On | ||
Line 14: | Line 14: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | Two domains pointing at a website one has a different starting point. | + | == Two domains pointing at a website one has a different starting point. == |
<syntaxhighlight lang="apache"> | <syntaxhighlight lang="apache"> | ||
Line 22: | Line 22: | ||
RewriteRule ^$ http://domain.com/filename.html [L,R=301] | RewriteRule ^$ http://domain.com/filename.html [L,R=301] | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | |||
+ | == 301 Redirect == | ||
+ | |||
+ | Redirect 301 /oldfile.htm http://example.net/ |
Revision as of 19:18, 9 September 2014
Contents
Redirect for SSL
RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [NC,R,L]
Another SSL redirect option
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
Two domains pointing at a website one has a different starting point.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteRule ^$ http://domain.com/filename.html [L,R=301]
301 Redirect
Redirect 301 /oldfile.htm http://example.net/