cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Go to solution

HTTP to HTTPS redirect not working

On my website (Linux shared hosting), somethingbetterinc.com, I have updated the hcaccess file as GD says to. But when I go to http, it still is not redirecting me to https. HTTPS on its own works, it's just not redirecting there.

 

To be clear, I want when someone goes to http://somethingbetterinc.com, that they are automatically redirected to https://somethingbetterinc.com

 

Here is the code I created for the file.

 

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

 

the file is named hcaccess and it saved right in the public_html folder. Thank you in advance for your help!

10 REPLIES 10
Helper IV
Helper IV

Re: HTTP to HTTPS redirect not working

it s .htaccess and not .hcaccess

Please save it as .htaccess 

If you have another file named .htaccess, you can copy the contents to it. But 

  • Do not duplicate RewriteEngine On.
  • Make sure the lines beginning RewriteCond and RewriteRule immediately follow the already-existing RewriteEngine On

Re: HTTP to HTTPS redirect not working

I'm sorry, I DID have it as htaccess - typo in my question.

 

I'm not sure what you mean by "Do not duplicate RewriteEngine On". And it does look like the lines immediately follow. When I download the htaccess file that I have, it looks just like this:

 

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

 

NOTE: The files appears to be "htaccess" not ".htaccess" (no dot). However, when I try to rename it to add the . It says that already exists. So I think I have that right, maybe???

 

cPanel_File_Manager_v3.png

 

 

 

cPanel_X_-_File_Manager.png

 

Helper IV
Helper IV
Solution

Re: HTTP to HTTPS redirect not working

the .htaccess file will be hidden by default. Use show hidden files option and then open it with editor and paste 

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

below the "RewriteEngine On", in the .htaccess file. 

 

"Do not duplicate RewriteEngine On" means that you should not add another "RewriteEngine On" condition to the .htaccess file, if it already contains "RewriteEngine On" command. I mean there should be "RewriteEngine On" present once in the .htaccess

 

 

 

Re: HTTP to HTTPS redirect not working

Fixed, thank you!

 

There were two files - htaccess and .htaccess. I never even noticed there were two. I was editing the wrong one. Thanks for the help!

New

Re: HTTP to HTTPS redirect not working

Thank you. I was able to do it that way. I purchased the bundle of 5 domain names and went into each one and added the .htaccess file and added that code. Worked. At least right now.

Re: HTTP to HTTPS redirect not working

I followed above but isnt working

Does this solution applies to subdomain too?

New

Re: HTTP to HTTPS redirect not working

Hi,

I am facing same problem 

i really want to redirect my site http to https, but i can't and i have no ssl certificate. 

 I have updated the hcaccess file too. But when I go to http is working, but when i  type https and my site url its still not redirecting.

Please help me how i fixes it.

Re: HTTP to HTTPS redirect not working

How do I get the "Show hidden files" option? I received redirect instructions from GoDaddy, and they start by telling me to open File Manager and then select the "Settings" option. I can't see any "Settings" option on the File Manager screen. I called GoDaddy support, and was told that they were unable to answer this question. Thanks a lot.

Helper IV
Helper IV

Re: HTTP to HTTPS redirect not working

@Monag1 You should have SSL certificate for HTTPS to work
Helper IV
Helper IV

Re: HTTP to HTTPS redirect not working

@alanfisk Better use FTP software's to see your files through ftp. There you have "show hidden files" and lot more options.