如何路由一个特定的URL到HTTP和HTTPS等人到了Apache httpd的HTTPS [英] How to route a particular URL to both http and https and others to https in Apache httpd

查看:290
本文介绍了如何路由一个特定的URL到HTTP和HTTPS等人到了Apache httpd的HTTPS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要的路线要求一个特定的URL, /新闻出版总署通过 http和https 和其它URL像 / AAPP,/ BAPP,/ CAPP 并通过 HTTPS 。我已经succeded路由一切HTTPS,但不能路由 /新闻出版总署为HTTP。下面是我的配置:

I have a requirement to route a particular url, /gapp via http and https and other urls like /aapp, /bapp, /capp and the rest via https. I have succeded in routing everything to https but can't route /gapp to http. Below is my configuration:

<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 

在简单的话,我希望能够做这些:

In simple words, I want to be able to do these:

http://example.com/gapp/
https://example.com/gapp/

我如何做到这一点?

How do I accomplish this?

推荐答案

我相信你正在寻找相同的答案是:<一href=\"https://stackoverflow.com/questions/9633882/htaccess-redirect-4-specific-pages-to-https\">.htaccess - htaccess的重定向4特定页面

I believe you are looking for the same answer as this: .htaccess - htaccess redirect 4 specific pages

如果您要访问其他一切然后在HTTPS和HTTP的几个网址,你会更好但不重定向只是做一个重写条件的URL,如果他们再搭配他们重定向到https:

If you want to access everything other then a few urls on https and http, you would be better not to redirect however just make a rewrite condition for the URLs and if they match then redirect them to https:

#force https for certain pages
RewriteCond %{REQUEST_URI} !^/gapp
RewriteCond %{HTTPS} !=on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R]

这篇关于如何路由一个特定的URL到HTTP和HTTPS等人到了Apache httpd的HTTPS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆