disable https for single page with htaccess

只愿长相守 提交于 2019-12-11 00:42:43

问题


I have tried some htaccess senteces but it doesn't work for me. I need to use whole site with https except one page it requires http connection from another site so i need to disable https for this page.

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

RewriteCond %{HTTPS} on
RewriteCond %{SCRIPT_FILENAME} \/exp\.php [NC]
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [L,NC]

browser says it seems there is too many redirections.


回答1:


You can use the following code :

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTPS} ^off$
RewriteCond %{REQUEST_URI} !exp\.php$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]


来源:https://stackoverflow.com/questions/34084170/disable-https-for-single-page-with-htaccess

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!