{"id":352,"date":"2020-07-01T16:20:36","date_gmt":"2020-07-01T10:50:36","guid":{"rendered":"https:\/\/www.websupporters.com\/support\/knowledgebase\/?post_type=ht_kb&amp;p=352"},"modified":"2020-07-01T16:20:36","modified_gmt":"2020-07-01T10:50:36","slug":"how-to-redirect-domain-or-website-http-to-https-using-htaccess-file","status":"publish","type":"ht_kb","link":"https:\/\/www.websupporters.com\/support\/knowledgebase\/kb\/how-to-redirect-domain-or-website-http-to-https-using-htaccess-file\/","title":{"rendered":"How to redirect domain or website HTTP to HTTPS Using .htaccess file"},"content":{"rendered":"<p>WebSupporters Linux Hosting servers support Apache URL Rewrite module. If you have an SSL certificate on your website, you can add\u00a0a few lines to your <strong>.htaccess<\/strong> file that will automatically redirect your visitors from HTTP to the HTTPS version of your website or domain.<\/p>\n<h2>To redirect domain or website HTTP to HTTPS Using .htaccess file.<\/h2>\n<ol>\n<li>Be sure that the SSL Certificate is properly installed on your domain, and the website is resolving on your domain like https:\/\/example.com<\/li>\n<li><a href=\"https:\/\/www.websupporters.com\/support\/knowledgebase\/knowledge-base\/how-to-login-cpanel\/\" target=\"_blank\" rel=\"noopener noreferrer\">Login to cPanel<\/a><\/li>\n<li>Once logged into cPanel, click on the \u201c<strong>File Manager<\/strong>\u201d located in the\u00a0<strong>Files<\/strong>\u00a0section of cPanel.<br \/>\n<a href=\"https:\/\/www.websupporters.com\/support\/knowledgebase\/wp-content\/uploads\/2020\/07\/htaccess_file_manager.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-357\" src=\"https:\/\/www.websupporters.com\/support\/knowledgebase\/wp-content\/uploads\/2020\/07\/htaccess_file_manager-300x75.jpg\" alt=\"\" width=\"300\" height=\"75\" \/><\/a><\/li>\n<li>It will open a new tab in your browser and once you are in File Manager, you will see a dashboard like below.<br \/>\n<a href=\"https:\/\/www.websupporters.com\/support\/knowledgebase\/wp-content\/uploads\/2020\/07\/file_manager-full.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-360\" src=\"https:\/\/www.websupporters.com\/support\/knowledgebase\/wp-content\/uploads\/2020\/07\/file_manager-full-300x143.jpg\" alt=\"\" width=\"300\" height=\"143\" \/><\/a><\/li>\n<li>Make sure that\u00a0<strong>Show Hidden Files (dotfiles)<\/strong>\u00a0is checked, and click\u00a0<strong>Save<\/strong><\/li>\n<li>Find the .htaccess file in <strong>root directory<\/strong>\u00a0like <strong>public_html<\/strong>. If your website is in a subfolder, then the .htaccess should be placed in the corresponding subfolder.<br \/>\n<a href=\"https:\/\/www.websupporters.com\/support\/knowledgebase\/wp-content\/uploads\/2020\/07\/htaccess_file_location.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-361\" src=\"https:\/\/www.websupporters.com\/support\/knowledgebase\/wp-content\/uploads\/2020\/07\/htaccess_file_location-300x141.jpg\" alt=\"\" width=\"300\" height=\"141\" \/><\/a><\/li>\n<li>Right-click on the .htaccess file and click on \u201cCode Edit\u201d on the menu.<\/li>\n<li>A dialogue box may pop up asking about encoding. Click the \u201cEdit\u201d button to continue.<br \/>\n<a href=\"https:\/\/www.websupporters.com\/support\/knowledgebase\/wp-content\/uploads\/2020\/07\/edit_file_manager_file.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-362\" src=\"https:\/\/www.websupporters.com\/support\/knowledgebase\/wp-content\/uploads\/2020\/07\/edit_file_manager_file-300x206.jpg\" alt=\"\" width=\"300\" height=\"206\" \/><\/a><\/li>\n<li>add following these rules in your website&#8217;s .htaccess file to redirect your domain or website HTTP to HTTPS:<br \/>\n<a href=\"https:\/\/www.websupporters.com\/support\/knowledgebase\/wp-content\/uploads\/2020\/07\/htaccess_redirect_rules.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-364\" src=\"https:\/\/www.websupporters.com\/support\/knowledgebase\/wp-content\/uploads\/2020\/07\/htaccess_redirect_rules-300x106.jpg\" alt=\"\" width=\"300\" height=\"106\" \/><\/a><\/p>\n<pre id=\"crayon-5efc6913d4488745672288-1\" class=\"crayon-line\"><span class=\"crayon-e\">RewriteEngine<\/span> <span class=\"crayon-e\">On<\/span>\n<span class=\"crayon-e\">RewriteCond<\/span> <span class=\"crayon-o\">%<\/span><span class=\"crayon-sy\">{<\/span><span class=\"crayon-v\">HTTPS<\/span><span class=\"crayon-sy\">}<\/span> <span class=\"crayon-e\">off<\/span>\n<span class=\"crayon-v\">RewriteRule<\/span> <span class=\"crayon-o\">^<\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-sy\">.<\/span><span class=\"crayon-o\">*<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-sy\">$<\/span> <span class=\"crayon-v\">https<\/span><span class=\"crayon-o\">:<\/span><span class=\"crayon-c\">\/\/%{HTTP_HOST}%{REQUEST_URI} [L,R=301]<\/span><\/pre>\n<\/li>\n<li>\u201cSave Changes\u201d when done.<\/li>\n<li>Test your website to make sure it is loading without any error. In case, there is an error, restore to the previous version and try again.<\/li>\n<li>Once you are done, click \u201cClose\u201d to close the window.<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WebSupporters Linux Hosting servers support Apache URL Rewrite module. If you have an SSL certificate on your website, you can add\u00a0a few lines to your .htaccess file that will automatically redirect your visitors from HTTP to the HTTPS version of your website or domain. To redirect domain or website HTTP&#8230;<\/p>\n","protected":false},"author":1,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":{"footnotes":""},"ht-kb-category":[4],"ht-kb-tag":[],"class_list":["post-352","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-cpanel"],"_links":{"self":[{"href":"https:\/\/www.websupporters.com\/support\/knowledgebase\/wp-json\/wp\/v2\/ht-kb\/352","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.websupporters.com\/support\/knowledgebase\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/www.websupporters.com\/support\/knowledgebase\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.websupporters.com\/support\/knowledgebase\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.websupporters.com\/support\/knowledgebase\/wp-json\/wp\/v2\/comments?post=352"}],"version-history":[{"count":0,"href":"https:\/\/www.websupporters.com\/support\/knowledgebase\/wp-json\/wp\/v2\/ht-kb\/352\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.websupporters.com\/support\/knowledgebase\/wp-json\/wp\/v2\/media?parent=352"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/www.websupporters.com\/support\/knowledgebase\/wp-json\/wp\/v2\/ht-kb-category?post=352"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/www.websupporters.com\/support\/knowledgebase\/wp-json\/wp\/v2\/ht-kb-tag?post=352"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}