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!
Solved! Go to Solution.
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
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???
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
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!
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.
I followed above but isnt working
Does this solution applies to subdomain too?
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.
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.