.htaccess - 为除 login.php 和 register.php 之外的每个页面关闭 SSL

标签 .htaccess mod-rewrite ssl

Options +FollowSymLinks 
RewriteEngine On

# Turn SSL off for everything except login.php (register.php)
RewriteCond %{HTTPS} on
RewriteCond %{SCRIPT_FILENAME} !\/login\.php [NC]
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L]

上面的代码用于为除 login.php 之外的每个页面关闭 SSL (https://)。如何添加 register.php 页面,以便在 login.php 和 register.php 页面上启用 https://协议(protocol)?我试着复制这条线

RewriteCond %{SCRIPT_FILENAME} !\/login\.php [NC]
**RewriteCond %{SCRIPT_FILENAME} !\/register\.php [NC]**

但这行不通,有什么想法吗?

最佳答案

您可以在相同的条件下同时使用登录和注册

RewriteCond %{SCRIPT_FILENAME} !\/(login|register)\.php [NC]

关于.htaccess - 为除 login.php 和 register.php 之外的每个页面关闭 SSL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7189484/

相关文章:

javascript - 禁止直接访问php文件(MVC)

regex - RedirectMatch/blog/.+ 但具体排除/blog/page/.+ ?

ruby-on-rails - rails 4 : Rack SSL enforcer ERR_SSL_PROTOCOL_ERROR with localhost

linux - 如何在 Apache 服务器上自动将 HTTP 重定向到 HTTPS?

php - 使用 .htaccess 和 php 重定向 url(如果它包含特定单词)

regex - mod_rewrite:用破折号替换下划线

regex - .htaccess mod_rewrite 超薄路由

ssl - libcurl https 发布大文件 ssl 读取错误?

ios - 无法查询 SecKeyChain 的身份

apache - 301 重定向到没有自动替换的单个 url