需要apache重写条件的帮助:
原始网址:
HTTP :服务//www.test.foo.com/SSO/login = HTTP%3A%2F%2F的 www.bar.com %2FC% 2Fportal%2Flogin
我需要的是:
HTTPS :服务//www.test.foo.com/SSO/login = HTTP%3A%2F%2F的 www.test.foo.com % 2FC%2Fportal%2Flogin
以下是我的配置:
<VirtualHost *:80>
ServerName www.test.foo.com
ServerAdmin admin@www.test.foo.com
ServerAlias www.test.foo.com
LogLevel warn
ErrorLog /var/log/apache2/www.test.foo.com.error.log
CustomLog /var/log/apache2/www.test.foo.com.access.log combined
ProxyRequests On
ProxyVia On
<Proxy *>
AddDefaultCharset Off
Order deny,allow
Allow from all
</Proxy>
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{QUERY_STRING} ^(.*?)www\.bar\.com(.*)$ [NC]
RewriteRule ^/?(SSO/.*)$ https://www.test.foo.com/$1?%1www.test.foo.com%2 [R,NE,L]
ProxyPass / ajp://localhost:8009/
ProxyPassReverse / ajp://localhost:8009/
</VirtualHost>
通过以上配置,我可以从http重定向到https。现在问题出在请求标题位置我还没有
HTTP :服务//www.test.foo.com/SSO/login = HTTP%3A%2F%2F的 www.bar.com %2FC% 2Fportal%2Flogin
任何人都可以帮我或建议重写条件吗?
答案 0 :(得分:2)
您可以在RewriteEngine On
行:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{QUERY_STRING} ^(.*?)www\.bar\.com(.*)$ [NC]
RewriteRule ^/?(SSO/.*)$ https://www.test.foo.com/$1?%1www.test.foo.com%2 [R,NE,L]