将 htaccess 限制为 tld 或将位置附加到末尾
对于带有购物车的网站,我们在domain.com/shop-2/cart 位置上运行https。当用户将购物车转到网站上的其他链接时,他们仍然处于 HTTPS 模式,这种模式很慢,并且实际上会给出错误,因为其他页面上的项目未设置 https 连接。
我已经能够成功检测到 https 请求并将其重定向到 http,但它没有附加当前用户位置(即 https://domain.com/test 应该是 http://domain.com/test 但结果是 http: // 域名.com)。我已经附加了到目前为止我正在使用的重定向代码。我试图让它离开 shop-2,因为我想要那里有 SSL 连接。
RewriteEngine On
RewriteCond %{ENV:HTTPS} =on
RewriteCond %{REQUEST_URI} !^/shop-2
RewriteRule (.*) http://domain.com/%1 [R=301,L]
我们正在开发 Rackspace 云站点服务器,因此使用 ENV:HTTPS。由于不同 IP 上的某些代理层,HTTPS 本身实际上并不能检测到我们使用的是 HTTPS。
这些空格位于域示例中,b/c 我没有足够的代表来发布 2 个以上的链接。
For a site with shopping cart we have https working on the domain.com/shop-2/cart location. When a user leaves the cart to other links on the site they are still sitting in HTTPS mode which is slow and actually gives an error b/c items on other pages are not setup for https connections.
I've been able to successfully detect https requests and redirect them to http but it's not appending the current user location (ie https:// domain.com/test should be http:// domain.com/test but comes out http:// domain.com). I've appended the redirect code I'm working with so far. I'm trying to get it to leave shop-2 alone since I want an SSL connection there.
RewriteEngine On
RewriteCond %{ENV:HTTPS} =on
RewriteCond %{REQUEST_URI} !^/shop-2
RewriteRule (.*) http://domain.com/%1 [R=301,L]
We're working on a Rackspace Cloud Sites server hence the ENV:HTTPS. HTTPS alone doesn't actually detect that we're on HTTPS because of some proxy layer on a different IP.
The spaces are in the domain examples b/c I don't have enough rep to post more than 2 links.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
$
是组的指示符,而不是%
。$
is the signifier for a group, not%
.