Difference between revisions of "Htaccess"

From KOP KB
Jump to: navigation, search
(301 Redirect)
Line 25: Line 25:
 
== 301 Redirect ==
 
== 301 Redirect ==
  
 +
<syntaxhighlight lang="apache">
 
Redirect 301 /oldfile.htm http://example.net/
 
Redirect 301 /oldfile.htm http://example.net/
 +
</syntaxhighlight>

Revision as of 00:25, 10 September 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]

301 Redirect

Redirect 301 /oldfile.htm http://example.net/