Log in

View Full Version : How to redirect site from http to https?



swatijain2233
05-14-2019, 11:19 AM
Hello friends,


I Have face A problem In My Website , Please tell me, How to redirect site from http to https?

ryanwuk
05-14-2019, 12:51 PM
There are many ways you can redirect your website from http to https.

1. Using .htaccess

Open your .htaccess file and add this code.

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

After successfully, You will redirect your website from HTTP to HTTPS.

RH-Calvin
05-15-2019, 09:07 AM
You can use 301 redirect. 301 redirect is the most efficient and Search Engine Friendly method for webpage redirection. It's not that hard to implement and it should preserve your search engine rankings for that particular page. If you have to change file names or move pages around, it's the safest option. The code "301" is interpreted as "moved permanently".

Servers Base
05-24-2019, 06:06 PM
In Apache:

1. Redirect All Web Traffic
If you have existing code in your .htaccess, add the following:

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

2. Redirect Only a Specific Domain
For redirecting a specific domain to use HTTPS, add the following:

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

3. Redirect Only a Specific Folder
Redirecting to HTTPS in a particular folder, add the following:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} folder
RewriteRule ^(.*)$ https://www.yourdomain.com/folder/$1 [R,L]

Note: Replace “yourdomain” with your actual domain name wherever required. Also, in case of the folder, replace /folder with the real folder name.

davidweb09
06-22-2019, 07:40 PM
You have redirect your old HTTP domain to new HTTPS domain using 301 redirect code.