- Web Development

Redirect Domain URL Using htaccess File

 

This article will disclose how to make a .htaccess document to divert your site or site content. This won’t divert any emails of your domain.

As an arrangement record, .htaccess is effective. Indeed, even the scarcest sentence structure mistake (like a missing space) can bring about your website content not showing accurately or by any means.

Since .htaccess is a shrouded framework record, please ensure your FTP customer is arranged to demonstrate concealed documents. This is generally an alternative in the program’s inclinations/choices.

Redirect to https://www

To redirect all type of versions of you website URL to https://www use the following code in your .htaccess file

RewriteEngine On
RewriteCond %{HTTPS} !on [OR]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule (.*) https://www.website.com%{REQUEST_URI} [L,R=301]

Redirect to http://www

To redirect all type of versions of you website URL to http://www use the following code in your .htaccess file

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

 

Share this:

Leave a Reply

Your email address will not be published. Required fields are marked *