我需要路由特定的网址,/gapp
via http and https
和其他网址,例如/aapp, /bapp, /capp
其余的通过https
。我已成功将所有内容路由到 https,但无法路由/gapp
到http。下面是我的配置:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} =on
RewriteRule ^(gapp)$ http://%{SERVER_NAME}%{REQUEST_URI} [L,R]
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^TRACE
RewriteRule .* - [F]
</IfModule>
# Should mod_jk send SSL information to Tomcat (default is On)
JkExtractSSL On
# What is the indicator for SSL (default is HTTPS)
JkHTTPSIndicator HTTPS
# What is the indicator for SSL session (default is SSL_SESSION_ID)
JkSESSIONIndicator SSL_SESSION_ID
# What is the indicator for client SSL cipher suit (default is SSL_CIPHER)
JkCIPHERIndicator SSL_CIPHER
# What is the indicator for the client SSL certificated (default is SSL_CLIENT_CERT)
JkCERTSIndicator SSL_CLIENT_CERT
# Send everything for context /examples to worker named worker1 (ajp13)
# JkOptions indicates to send SSK KEY SIZE
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat
JkRequestLogFormat "%w %V %T"
JkMount /aapp aapp
JkMount /bapp/* bapp
JkMount /capp capp
JkMount /gapp gapp
JkMount /gapp/* gapp
简而言之,我希望能够做到这些:
http://example.com/gapp/
https://example.com/gapp/
我该如何实现这个目标?
我相信您正在寻找与此相同的答案:.htaccess - htaccess 重定向 4 个特定页面 https://stackoverflow.com/questions/9633882/htaccess-redirect-4-specific-pages-to-https
如果您想访问除 https 和 http 上的几个 url 以外的所有内容,最好不要重定向,而只需为 URL 制定重写条件,如果它们匹配,则将它们重定向到 https:
#force https for certain pages
RewriteCond %{REQUEST_URI} !^/gapp
RewriteCond %{HTTPS} !=on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R]
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)