PHP.htaccess point子域到根目录,无需重定向
我需要将子域指向(而不是重定向)根域中的目录。例如,我有以下域:PHP.htaccess point子域到根目录,无需重定向,php,.htaccess,mod-rewrite,Php,.htaccess,Mod Rewrite,我需要将子域指向(而不是重定向)根域中的目录。例如,我有以下域: https://test.example.com 我想指出目录: https://example.com/apple 这需要在不更改子域URL的情况下进行。它还需要包括任何URL参数,例如: https://test.example.com/hello-world 应指向(而不是重定向)到: 在我的.htaccess文件(子域的根目录)中,我有: 这是可行的,但它会重定向。关于如何在不使用mod_proxy的情况下将子域指向
https://test.example.com
我想指出目录:
https://example.com/apple
这需要在不更改子域URL的情况下进行。它还需要包括任何URL参数,例如:
https://test.example.com/hello-world
应指向(而不是重定向)到:
在我的.htaccess
文件(子域的根目录)中,我有:
这是可行的,但它会重定向。关于如何在不使用
mod_proxy
的情况下将子域指向该目录而不重定向的任何建议?请尝试下面的规则,我假设两个域都指向同一位置
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^test\.example\.com$
RewriteRule ^(.*)$ apple/$1 [L]
可能是@ponury kostek的副本所有这些都是重定向的。我更新了我的问题,我可能无法打开mod_代理(它是一个共享服务器)。
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^test\.example\.com$
RewriteCond %{REQUEST_URI} !^/apple$
RewriteRule ^(.*)$ https://example.com/apple/$1
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^test\.example\.com$
RewriteRule ^(.*)$ apple/$1 [L]