处理子域和https使用的.htaccess

编程入门 行业动态 更新时间:2024-10-19 00:28:50
本文介绍了处理子域和https使用的.htaccess的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在下面的.htaccess例如,如果有人类型类似如下的URL ......

In the .htaccess example below, if someone types in a URL like the following...

mysite/ricks-motorcycles

...它会自动从x的子目录页面public_html下称里克斯 - 摩托车。这种技术被称为的代理吞吐的。

...it will automatically load the page from x's subdirectory under public_html called "ricks-motorcycles". This technique is called Proxy Throughput.

RewriteEngine On RewriteRule ^ricks-motorcycles/(.*)$ x/ricks-motorcycles/$1 [P,L]

这是伟大的,但我怎么处理其他两种情况:

This is great, but how do I handle two other situations:

(1)有人想HTTPS代替HTTP。

(1) Someone wanting https instead of http.

(2)有人想...

HTTP#// ricks-motorcycles.mysite /

http#//ricks-motorcycles.mysite/

...

HTTP#// mysite/ricks-motorcycles /

http#//mysite/ricks-motorcycles/

(开关#有:以上是因为计算器是可以发布挡住我)

(Switch # with : above because StackOverflow was blocking me from posting.)

推荐答案

您可以限定你重写了的RewriteCond :

RewriteEngine On RewriteCond %{HTTPS} =on RewriteRule ^ricks-motorcycles/(.*)$ example/ricks-motorcycles/$1 [P,L] RewriteCond %{HTTP_HOST} =ricks-motorcycles.mysite RewriteRule ^(.*)$ example/ricks-motorcycles/$1 [P,L]

有关详细信息,请参见 mod_rewrite的文档。

For more information, see the mod_rewrite documentation.

更多推荐

处理子域和https使用的.htaccess

本文发布于:2023-10-31 16:08:17,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1546595.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:https   htaccess

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!