SOLVED - Modify .htaccess file for https

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 ^(.*)$ https://yourdomain.com/$1 [R=301,L]

Can anyone see if this is working for me?

thanks :slight_smile:

1 Like

It works for me. :slight_smile:

1 Like

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

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.

http://htaccess.madewithlove.be

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

2 Likes

Thanks for the link… So I got this:

Does that mean I’m ok?

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.

1 Like

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 ^(.*)$ https://www.emilybolam.com/$1 [R,L]

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

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

TIA

Rob

1 Like

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 ^(.*)$ https://yourdomain.com/$1 [R=301,L]

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 www.emilybolam.com into your browser and see if returns the https version?

Thanks

1 Like

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

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

1 Like

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

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

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

I tried the debugger/testing tool linked above (http://htaccess.madewithlove.be/) 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

1 Like

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.

Buggeration.

Rob

1 Like

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.

1 Like

OK, so I changed it to this?

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
Hello toodle-oo
RewriteRule ^(.*)$ https://www.emilybolam.com/$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

Rob

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:

1 Like

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.

Thanks

Rob

1 Like