Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove https from a certain page

My whole site is secure but I want to remove the https from a certain page. Is there a way to do that in the htaccess file or php code?

Here is my current htacces file.

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

</IfModule>

Added

RewriteCond %{REQUEST_URI} !/page [NC]

Works for desktops browsers. I tried opening the page on mobile safari on iphone 7 but the page comes back secure.

Cleared the cache and added this but still no luck

<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />

thanks in advance.

like image 435
Carlitos Avatar asked Jun 04 '26 13:06

Carlitos


1 Answers

You can exclude a certen page from https redirection using the following condition :

Put this right above the RewriteRule line

RewriteCond %{REQUEST_URI} !/page [NC]

This skips the RewriteRule if requested uri matches the pattern and is /page .

like image 81
Amit Verma Avatar answered Jun 07 '26 13:06

Amit Verma



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!