User Tools

Site Tools


internet:hosting:redirect

This is an old revision of the document!


Web Site Redirection

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):

vim .htaccess
# This temporarily redirects your entire website to another domain
Redirect 302 / http://mt-example.com/

Redirect HTTP to HTTPS:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]

A permanent version:

<IfModule mod_rewrite.c>
 RewriteEngine On
  RewriteCond %{HTTPS} !on
  RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
internet/hosting/redirect.1542724655.txt.gz · Last modified: 2018/11/20 07:37 by gcooper