SOLVED - Modify .htaccess file for https

(Lisa Sandler) #1

Can anyone help me figure out how to find and change my .htaccess file to make my website always go to the https version? I don’t even know where to find it.

update. I found the file and pasted code: (replaced your domain with mine).
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$$1 [R=301,L]

Can anyone see if this is working for me?

thanks :slight_smile:

SSL Zertifikat unter Rapidweaver einbinden?
Change font links from http to https?
(David) #2

It works for me. :slight_smile:

(Lisa Sandler) #3

awesome, thanks. Not being a programmer, these things can be confusing for me.

(Doug Bennett) #4

Yes it worked for me as well.
I would recommend for other people to always use a 302 (r=302) until after you have tested completely then change to a r=301.
HTTP RC 301’s are permanent. As such they are cached by browsers and proxy servers with no set expiration date.

Above is a site to unit test .htaccess file redirects.

(Lisa Sandler) #5

Thanks for the link… So I got this:

Does that mean I’m ok?

(Doug Bennett) #6

Yes your great.
The test stopped means that it met your condition and redirected. If you had other rules ( Apache directives) below this redirect it is telling you it stopped processing and did the redirect.

(Rob Beattie) #7

I’ve been trying to do exactly the same as @LSPhoto with the same host (Chillidog) and am having no joy at all.

Here’s what my .htaccess file has in it.

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$$1 [R,L]

but going to or doesn’t re-direct to the https:// version.

Any clues as to where I’ve wandered off course gratefully received.



(Lisa Sandler) #8

I honestly don’t even remember how I did this… but your code does look a little different than mine… not sure if the 301 will fix it?

RewriteRule ^(.*)$$1 [R=301,L]

(Rob Beattie) #9

Curiouser and curiouser. It doesn’t make any difference in Safari or Chrome but using a just downloaded version of Firefox, it does work.

Could you do me a favour @LSPhoto and just put into your browser and see if returns the https version?


(Lisa Sandler) #10

I tried all 3 browsers and not seeing the lock indicating ssl.

(Rob Beattie) #11

Ah well, back to the drawing board. Thanks for trying.

(Jason Bostick) #12

Do you have anything else in your htaccess file? I remember instructions for this stating that it should be above other rules with similar prefixes

(Rob Beattie) #13

Nope, nothing else. Just exactly what I’ve listed.

(Lisa Sandler) #14

Mine has lots of code in it for all pages… but I think it was generated… I didn’t type it.

(Jason Bostick) #15

I tried the debugger/testing tool linked above ( and it all seemed to pass ok so, short of some caching thing with cloudflare or something (which wouldn’t impact htaccess files, I wouldn’t think), I’m unfortunately out of ideas/expertise. Maybe Greg will be able to get you sorted if you haven’t already started a ticket with him

(Rob Beattie) #16

I’ve started a ticket with @barchard but again he seems to think there’s nothing wrong with the .htaccess file. But Im no further forwards in understanding why it’s not working for me and for others.

I used the same tool to test it - as recommended in another forum thread - and got the same result.



(Doug Bennett) #17

It sounds like your htaccess file may not be working (read). There are internal apache directives; the file could be in the wrong place, etc. Try placing "junk in the file (anything that is not a good htaccess syntax), you should get a 500 error if it is being read.

(Rob Beattie) #18

OK, so I changed it to this?

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
Hello toodle-oo
RewriteRule ^(.*)$$1 [R=301,L]

But when I re-load the site, it appears as before. So does that mean the file isn’t being read?

It’s in my root directory which on CDog is public_html


(Gregory Barchard) #19

Please don’t touch or modify things while I investigate your ticket. Thanks :slight_smile: too many cooks in the kitchen spoil the broth :slight_smile:

(Rob Beattie) #20

Happy to sit back and let the master do his work. But what with this and a related Google SNAFU I’d really like to get it solved.