Difference between revisions of "Htaccess"
From KOP KB
(Created page with "Redirect for SSL <syntaxhighlight lang="apache"> RewriteEngine on RewriteCond %{SERVER_PORT} !^443$ RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [NC,R,L] </syntaxhighlight>...") |
|||
Line 5: | Line 5: | ||
RewriteCond %{SERVER_PORT} !^443$ | RewriteCond %{SERVER_PORT} !^443$ | ||
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [NC,R,L] | RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [NC,R,L] | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | Another SSL redirect option | ||
+ | <syntaxhighlight lang="apache"> | ||
+ | RewriteEngine On | ||
+ | RewriteCond %{HTTPS} off | ||
+ | RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 15:30, 6 August 2014
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]