I have a simple HTML web site that I have added an SSL certificate. I have added the following code to the .htaccess file with my domain name.
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^(www\.)?coolexample\.com
RewriteRule ^(.*)$ https://www.coolexample.com/$1 [R,L]
The code does redirect to a simple page that has a link to the web site. My question is, will this change over time and go right to the site or is there something else I have to code to get the redirect right to my website? Also, do I need to set the R to R=301?
If anyone can help, I would appreciate it.
Thank you,
R
Solved! Go to Solution.
Following the instructions for redirecting domain to https at:
https://www.godaddy.com/help/redirect-my-cpanel-website-to-https-27870
I experienced redirect to:
and 404 error.
I then tried the slightly different instructions at
https://www.inmotionhosting.com/support/website/ssl/how-to-force-https-using-the-htaccess-file
that add [NC] and more specifically say [R=301,L]
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^(www\.)?nearbyreality\.com [NC]
RewriteRule ^(.*)$ https://www.nearbyreality.com/$1 [R=301,L]
This redirect is working ok.
Phil
Thank you davisdre317 for the reply to my post. The first article I used for my website because it is a simple HTML website. The other article I did not use because It referred to word press. I am trying to figure out if I need to add anything else to the code in the .htaccess file, so that when some one searches for my web site on, Google, Bing etc that they are not redirected to a a "Found page - The document has moved here" page. I want to have the link go straight to the web site and not to a Found page.
If there is no code to add, will the browsers in the future just automatically redirect to the site without going to the Found page.
Any help would be appreciated.
R
Thank you again davisdre317 for your quick reply.
One last question: Is it best to leave it as it is, or should I change the [R,L] to [R=301, L].
I have been reading that the way I have it now is temporary where 301 is permanent. Is there a difference or should I leave well enough alone. Some say it does not matter.
Thanks for all your help.
R
davisdre317
You have been a great help. I appreciated all the information you have given me.
Thank you,
R
Following the instructions for redirecting domain to https at:
https://www.godaddy.com/help/redirect-my-cpanel-website-to-https-27870
I experienced redirect to:
and 404 error.
I then tried the slightly different instructions at
https://www.inmotionhosting.com/support/website/ssl/how-to-force-https-using-the-htaccess-file
that add [NC] and more specifically say [R=301,L]
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^(www\.)?nearbyreality\.com [NC]
RewriteRule ^(.*)$ https://www.nearbyreality.com/$1 [R=301,L]
This redirect is working ok.
Phil
Thanks for sharing @nearbytv! It's super helpful to other community members that might be experiencing the same issue. Take care and hope to see you around the Community more.
Rachel
I already had the [NC], and was just getting ready to change [R,L] to [R=301,L], but decided to test the site before I mad the change.
Lo and behold, it is working fine, although I realize the default redirect is 302, not 301. So I'll add the R=301.
The offered solution works only in 3 of 4 cases:
I suspect the problem is because coming from https in #4 does not meet the port condition (port 443, not port 80)
How do I get around this, short of buying more certificates so I can secure both the domain by itself and also the domain with the www subdomain (e.g, mydomain.com & www.mydomain.com)??????????????????????
Copyright © 1999 - 2021 GoDaddy Operating Company, LLC. All Rights Reserved.
Use of this Site is subject to express terms of use. By using this site, you signify that you agree to be bound by these Universal Terms of Service.