Stop https for a referer

35 Views Asked by At

I have a https website which has a hidden user area. From there the users has a link which links to a http site. With a referrer the site makes sure that the userers are coming from my site. Other access attemps are blocked.

Since my webstie change to https, there referrer is not working anymore.

My solution attempt so far: Inside my htaccess I want to stop the https for only one file on the site. Where the link is. My htaccess so far.

ErrorDocument 404 /404.php

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/Mitgliederservice/Infoline/index\.php$ [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
1

There are 1 best solutions below

0
On

I don't understand whether you want to exclude one page or force only one page to https so , if you want to exclude one specific page use the following code :

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_URI} !^/path/to/yourpage\.php$ 
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R]

otherwise use the following code :

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_URI} ^/path/to/yourpage\.php$ 
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R]