Domain redirection

Domain redirection

There are a few way to redirect a site.

1. using meta refresh.

Meta refresh is a method of instructing a web browser to automatically refresh the current web page or frame after a given time interval, using an HTML meta element with the http-equiv parameter set to “refresh” and a content parameter giving the time interval in seconds. It is also possible to instruct the browser to fetch a different URL when the page is refreshed, by including the alternative URL in the content parameter. By setting the refresh time interval to zero (or a very low value), meta refresh can be used as a method of URL redirection.

<meta http-equiv="refresh" content="0;url=http://www.mortgageedge.ca/Judy-Yin"/>

2. using .htaccess file.

The .htaccess editor is a powerful tool with which advanced users can customize their website. When using this tool, your first step will always be to select the domain and directory where you are applying the changes.

Add one of the following code snippets into your .htaccess file (based on what you want to do.

Old to new domain – Update “OLDDOMAIN” to the old domain you want to redirect to and update the “NEWDOMAIN” to the new domain it is redirecting to.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^OLDDOMAIN.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.OLDDOMAIN.com [NC]
RewriteRule ^(.*)$ http://NEWDOMAIN.net/$1 [L,R=301,NC]

HTTPS – Redirect for SSL Certificate, update the “DOMAIN” to the domain that requires the redirect from HTTP to HTTPS Click Save.

RewriteEngine On 
RewriteCond %{HTTP_HOST} ^DOMAIN.com [NC]
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.DOMAIN.com/$1 [R=301,L]

3. using 301 redirect

301 is one of the HTTP response status code used for permanent URL redirection. This type of redirect is best for SEO purposes and also informs the search engines that the site has moved permanently. If you change your domain name and want to point to a different URL, a 301 redirect is your best choice.

A 301 redirect is also the preferred type of redirect to use when configuring an SSL certificate where you want to redirect your site visitors from a non-secure address like http://domain.com to a secure address like https://domain.com.

301 redirect

460 total views, 4 views today

Author: Albert

Leave a Reply