瞄准
我想将我网站的特定页面重定向到 http。
背景
我有以下.htacess
Options All -Indexes
RewriteEngine On
RewriteRule ^(.*)\.html $1\.php [L]
RedirectMatch ^/*$ https://**mydomain_name**/files/index.php
Options +SymLinksIfOwnerMatch
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /files/error.php [L]
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
它允许我将所有内容重定向到 https(而且效果很好)
问题
是否可以将地址包含 internal (https://mydomain_name/internal/) 的所有页面重定向到 http(而不是 https)?
最佳答案
更好的是,我们可以保持条件不处理对包含 internal 的 URI 的请求,而不是先将它们重定向到 https,然后再返回到 http 以获得特别提到的 URI。
Options All -Indexes
RewriteEngine On
RewriteRule ^(.*)\.html $1\.php [L]
RedirectMatch ^/*$ https://**mydomain_name**/files/index.php
Options +SymLinksIfOwnerMatch
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /files/error.php [L]
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/internal [NC]
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
关于apache - 是否可以将我网站的特定页面(使用 https)重定向到 http?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65369564/