Rya*_*all 3 apache mod-rewrite
我有一个PHP-Apache应用程序mod_rewrite用于干净的URL.我有很多需要将某些页面和路径强制转换为HTTPS,同时还要确保所有其他页面和路径保持为HTTP.
这是我的意思的一个例子:
// http://www.example.com/panel/ -> Should always redirect to HTTPS
// http://www.example.com/store/ -> Should always redirect to HTTPS
// Anything not in the above should always be HTTP
// so...
// https://www.example.com/not-in-above-rules -> Should always redirect to HTTP
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
ter*_*ten 10
你可以把这样的东西放在你的:80 vhost中:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(panel/|store/payment) https://%{HTTP_HOST}%{REQUEST_URI}
Run Code Online (Sandbox Code Playgroud)
这在你的:443 vhost:
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule !^(panel/|store/payment) http://%{HTTP_HOST}%{REQUEST_URI}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6399 次 |
| 最近记录: |