N
N
Nikolai Khokhlunov2018-03-05 15:42:24
htaccess
Nikolai Khokhlunov, 2018-03-05 15:42:24

Exception in .htaccess redirect to https for script?

RewriteEngine on
RewriteCond %{HTTP:HTTPS} !=on [NC]
RewriteRule ^(.*)$ https://site.ru/$1 [R=301,L]
SetEnvIf X-Forwarded-Proto https HTTPS=on
Like here add a condition so that it ignores site.ru/script.php for example

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey, 2018-03-05
@nik0lazz

It's different for everyone, it depends on the settings.
Try like this:

<IfModule mod_rewrite.c>
RewriteBase /
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{REQUEST_URI} !script.php
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} ^www.site.ru$ [NC]
RewriteRule ^(.*)$ https://site.ru/$1 [R=301,L]
</IfModule>

or like this:
RewriteBase /
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{REQUEST_URI} !script.php
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} ^www.site.ru$ [NC]
RewriteRule ^(.*)$ https://site.ru/$1 [R=301,L]

To the extreme, here's how they write here https://stackoverflow.com/questions/18600461/forci... some
of the methods will help. Toko, before each check, clean both cookies and cache and browser history, otherwise it caches ssl tightly tightly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question