How to redirect http to https using


If you are reading this article, we can safely assume that you have already purchased an SSL certificate & looking forward lớn installing it. If you are still struggling in choosing the right SSL for your website, check outthis articletounderstand the different SSL types andselect the best-suited SSL with cost-efficient options.

Bạn đang xem: How to redirect http to https using

Secure a WordPress trang web with An SSL Certificate – Save 79%

Save 79% on a highly trusted Positive SSL, an ideal solution for WordPress CMS websites. It includes unlimited server licenses, reissuances, 256-bit encryption, and more.

Shop for Positive SSL and Save 79%

If you are looking forhelpredirecting HTTP to lớn HTTPS onaWordPress site, consider our expert guide onHow lớn Install An SSL Certificate on WordPress.

HTTP to HTTPS Redirection Guide with .htaccess

Locate .htaccessin cPanel tệp tin Manager

Go lớn cPanelClick on tệp tin Manager under ‘Files.’

Select the option for Document Root for. Select the domain name from the drop-down menu. OR click on ‘Settings’ on the upper right side of the page if you have only one website. Locate the .htaccess fileThe .htaccess tệp tin is always hidden. So, kiểm tra “Show Hidden Files (dotfiles)”



Before editing the code, there are a few things you should take into consideration:

Your .htaccess tệp tin must be stored in the website’s root thư mục or in the same folder where your site is located.Search for the word RewriteEngine On in .htaccess file to avoid repetition. If RewriteEngine On is already written in the .htaccess file, địa chỉ cửa hàng the below code immediately after it (don’t duplicate the RewriteEngine On line) Type your own tên miền name in place of

.htaccess Code for HTTP to lớn HTTPS Migration Without WWW

If you want your website’s non-www version khổng lồ run on HTTPS (i.e., HTTPS://, địa chỉ cửa hàng these lies in the .htaccess file:

RewriteEngine On RewriteCond %HTTPS off RewriteRule ^(.*)$ HTTPS://

.htaccess Code for HTTP khổng lồ HTTPS Migration for WWW Version

If you are redirecting the WWW version of your domain to HTTPS (i.e., HTTPS://, showroom the below code to the .htaccess file

RewriteEngine On RewriteCond %HTTP_HOST !^www.

Xem thêm: Windows Xp "Khai Tử" Nên Cài Win 7 Hay Win 8.1, Nên Chọn Cài Win 10, Win 8 RewriteRule ^ HTTPS:// %HTTP_HOST%REQUEST_URI

RewriteCond %HTTP:X-Forwarded-Proto !HTTPSRewriteCond %HTTPS off RewriteRule ^ HTTPS:// %HTTP_HOST%REQUEST_URI

Redirect All website Traffic from HTTP lớn HTTPS

If you want to redirect all web traffic khổng lồ HTTPS (insteadof redirecting khổng lồ a specific site/webpage/folder), insert these codes.

RewriteEngine On RewriteCond %SERVER_PORT 80 RewriteRule ^(.*)$ HTTPS://$1

Redirect a Particular domain name from HTTP to lớn HTTPS

If you have multiple domains and want lớn redirect only a specific domain name from HTTP to HTTPS, insert following codes.

RewriteEngine On RewriteCond %HTTP_HOST ^ RewriteCond %SERVER_PORT 80 RewriteRule ^(.*)$ HTTPS://www.

Xem thêm: Nhận Làm Thêm Tại Nhà Online, 1001 Việc Làm Thêm Tại Nhà Dễ Kiếm Tiền Triệu$1

Redirect Only a Specific folder (webpage) to lớn HTTPS

For some reasons, people choose khổng lồ keep only some webpages on HTTPS, while keeping other pages on HTTP. To Redirect a specific folder/webpage to HTTPS, write following code:

RewriteEngine On RewriteCond %SERVER_PORT 80 RewriteCond %REQUEST_URI thư mục RewriteRule ^(.*)$ HTTPS://$1