User Tools

Site Tools


internet:hosting:redirect

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
internet:hosting:redirect [2014/07/14 15:48]
gcooper created
internet:hosting:redirect [2018/11/20 07:38] (current)
gcooper
Line 2: Line 2:
  
 Here we redirect a web site to another web site in a very simple way. Here we redirect a web site to another web site in a very simple way.
 +
 +:!: A 302 is a temporary redirect.
  
 Edit or create a small text file in the root of your web site (often ''public_html''): Edit or create a small text file in the root of your web site (often ''public_html''):
Line 8: Line 10:
 vim .htaccess vim .htaccess
 </file> </file>
 +
 +===== Entire Site Somewhere Else =====
  
 <file> <file>
Line 14: Line 18:
 </file> </file>
  
 +===== Redirect HTTP to HTTPS =====
 +
 +<file>
 +RewriteEngine On
 +RewriteCond %{HTTPS} off
 +RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]
 +</file>
 +
 +A permanent version:
 +
 +<file>
 +<IfModule mod_rewrite.c>
 + RewriteEngine On
 +  RewriteCond %{HTTPS} !on
 +  RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
 +</IfModule>
 +</file>
internet/hosting/redirect.1405374527.txt.gz · Last modified: 2014/07/14 15:48 by gcooper