Post by screwloose2018 » Wed Feb 07, 2018 12:08 am

Hi, i know this has been covered before so my apologies if i have missed the answer on other posts but im stuck.

I am trying to get all my pages to https:// and have tried many solutions previously posted
This is the current one, but i have honestly been through all variations -
RewriteCond %{HTTP_HOST} catering-spareparts\.co\.uk [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.catering-spareparts.co.uk/$1 [R=301,L]

Also i have altered the config files to represent what all the other posts have suggested.

I either get no result or err too many redirects..... seems to be no in-between.

I have got to the point where i am going round in circles, so any help would be much appreciated.....

Thanks.


Posts

Joined
Tue Feb 06, 2018 11:50 pm

Post by MrPhil » Wed Feb 07, 2018 11:12 pm

Try this:

Code: Select all

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.  [NC,OR]
RewriteCond %{HTTPS} !on
RewriteRule ^(.*)$ https://www.catering-spareparts.co.uk/$1  [R=301,L]
Also check that you don't have any other rewrites in your .htaccess file(s) that are still going to http: -- that can put you in a loop with "too many redirects".

User avatar
Active Member

Posts

Joined
Wed May 10, 2017 11:52 pm

Post by screwloose2018 » Thu Feb 08, 2018 3:20 am

Thanks for the quick response.
Unfortunately the code you supplied didn't work.

I have searched and can only find one other htaccess file -
<Files *.*>
Order Deny,Allow
Deny from all
</Files>

Would it be possible to pm you the htaccess file and maybe you could tell me if I'm missing anything glaringly obvious?

The problem i have is at this stage i think it may be some sort of err on the servers part but unless i can prove it they aren't going to admit to it - I had a similar issue with getting export/import to work which they said was to do with my end and after a bit of research i manage to convince them it was there install of php, which it was!

Thanks.


Posts

Joined
Tue Feb 06, 2018 11:50 pm

Post by MrPhil » Thu Feb 08, 2018 6:57 am

Sure, I could take a look at your .htaccess. Some things to look at first:

  1. Some hosts have weird setups where giving a valid path makes the server skip over higher level directories, and go directly to the given one. This would miss the /.htaccess, although I can't see it causing a "too many redirects" loop.
  2. There can be oddities in SSL support where %{HTTPS} doesn't work as expected (return on or off), and you'll need to use %{SERVER_PORT} (80 is http).
Note that your original code tested if the domain name (HTTP_HOST) contained catering-spareparts.co.uk, and thus would match either catering-spareparts.co.uk OR www.catering-spareparts.co.uk. If you were trying to match only the former, it wouldn't work. If you have several domain names being handled, how that is done can vary from host to host. My assumption in the code I gave you was that you wanted https://www.catering-spareparts.co.uk, but your test was for a domain of catering-spareparts.co.uk AND http:. Could you clarify the situation?

User avatar
Active Member

Posts

Joined
Wed May 10, 2017 11:52 pm
Who is online

Users browsing this forum: No registered users and 58 guests