gpt4 book ai didi

apache - 如何在 Apache httpd 中将特定 URL 路由到 http 和 https,以及将其他 URL 路由到 https

转载 作者:可可西里 更新时间:2023-11-01 16:37:49 26 4
gpt4 key购买 nike

我需要通过 http 和 https 路由特定的 url,/gapp 以及 /aapp、/bapp、/capp 等其他 url code>,其余通过 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 redirect 4 specific pages

如果你想访问除 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]

关于apache - 如何在 Apache httpd 中将特定 URL 路由到 http 和 https,以及将其他 URL 路由到 https,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25803626/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com