This guide will walk you through adding code to you htaccess file to redirect or rewrite URLs on your website.

How to redirect all URLs to a new site

Option 1 — Redirect all old URLs to the new domain name

Redirect 301 / https://example.co.za/

Option 2 — Redirect all old URLs to the new URL

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTP_HOST} ^example.co.za$ [OR]
  RewriteCond %{HTTP_HOST} ^www.example.co.za$
  RewriteRule (.*)$ https://www.absolutehosting.co.za/$1 [R=301,L]
</IfModule>

Redirecting a single URL

Redirect to a local site file

Redirect /path/to/file/old.html /path/to/file/new.html

Redirect to an external site file

Redirect /path/to/file/old.html https://www.absolutehosting.co.za/new/file/new.html

Redirecting error messages

ErrorDocument 404 https://example.co.za/

 

 

Was this answer helpful? 0 Users Found This Useful (1 Votes)