SSL redirect error

target40.cf

SSL not redirecting automatically

(I have a ssl certificate for above mentioned site but and my base URL is also redirected to https and it’s working fine but problem is that when I only enter target40.cf or http://target40.cf it doesn’t redirect to https.)

Please tell me how to fix this

Welcome, pls read…

In short, add these to your .htaccess file (inside htdocs directory)

RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

3 Likes

Maybe format it like…

RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

I have no .htaccess file

create one then

2 Likes

How to redirect to https

Go to htdocs ad create a file called .htaccess and then put the following contents:


RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

But it shows too many redirects

I created but it shows too many redirects

Ah. Then you might need write this:

RewriteEngine On
RewriteCond %{SERVER_PORT} !^433$
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=302]

It still says too many redirects
For your information my base URL is set to https if need

Read this…

2 Likes

Oh, I just realized I made a mistake. Read the edited post.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.