How to prevent a specific page from being redirected to https without using php?

Asked

Viewed 48 times

2

Hello. I need to avoid redirecting a page from my site to https, but I didn’t want to use php, java, or other programming language.

I’d like to use the .htaccess

On my website, I used the rule below on . htaccess to redirect all pages of the site to HTTPS.

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

Works perfectly! But there are specific pages that I need to get HTTP, because they display external content via iframe that comes in HTTP, and HTTP is not displayed within HTTPS.

I tried, add to the end the url the code -no_ssl

And I added the excerpt below in htaccess so that ssl wouldn’t be applied to urls that ended with -no_ssl

RewriteCond ^(.*)$ ([^-]|-[^n]|-n[^o]|-no[^_]|-no_[^s]|-no_s[^s]|-no_ss[^l])$ 

So the whole code went like this:

# Forçando https
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond ^(.*)$ ([^-]|-[^n]|-n[^o]|-no[^_]|-no_[^s]|-no_s[^s]|-no_ss[^l])$ 
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

So I hoped the page meudominio.com/contact-no_ssl were not redirected to https. But it doesn’t work.

Where can I be missing?

  • 2

    Because they blocked my question, there are other questions here about .htaccess. What’s wrong with mine? What does it have different from this one? https://answall.com/questions/102722/o-que-significam-rewritecond-e-rewriterule-em-um-arquivo-htaccess#

  • 1

    Indeed, the issue fits perfectly in this forum.

  • If anyone can help me, thank you, or if you have any way of questioning this blockade, I expected more from the platform. Anyone can come and go closing questions just because it worked out and there is no way to turn to other users. very strange.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.