简体   繁体   中英

Leave one page HTTP on a HTTPS website htaccess

I'm no good with htaccess but one of my websites is using https.

I have this simple code in the htaccess:

RewriteEngine On 

RewriteCond %{HTTP_HOST} ^SITENAME.com$ 

RewriteRule ^(.*) http://www.SITENAME.com/$1  [QSA,L,R=301]

RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} 

The issue is that I have one page needing to be in HTTP as I need to pass a POST notification to a page called call.php from another website and it won't send to an HTTPS address (or it does but my server doesn't want it).

Anybody help please? How do I write an exception for a specific page?

Have it this way:

RewriteEngine On 

RewriteCond %{HTTP_HOST} ^SITENAME\.com$ 
RewriteRule ^ http://www.SITENAME.com%{REQUEST_URI} [L,R=301]

RewriteCond %{HTTPS} off
RewriteRule !^call\.php https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NC]

RewriteCond %{HTTPS} on
RewriteRule ^call\.php http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NC]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM