【发布时间】:2017-02-22 18:54:08
【问题描述】:
我需要将子域指向(而不是重定向)到根域中的目录。例如我有以下域:
https://test.example.com
我希望它指向目录:
https://example.com/apple
这需要在不更改子域的 URL 的情况下发生。它还需要包含任何 URL 参数,例如:
https://test.example.com/hello-world
应该指向(而不是重定向)到:
https://example.com/apple/hello-world
在我的.htaccess 文件中(在子域的根目录中)我有:
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^test\.example\.com$
RewriteCond %{REQUEST_URI} !^/apple$
RewriteRule ^(.*)$ https://example.com/apple/$1
这可行,但它会重定向。关于如何在不使用mod_proxy 的情况下将子域指向该目录而不重定向的任何建议?
【问题讨论】:
-
@ponury-kostek 所有这些都是重定向
标签: php .htaccess mod-rewrite