Apache 将子域重定向到目录,但不更改url

Apache 将子域重定向到目录,但不更改url,apache,.htaccess,Apache,.htaccess,我拥有服务器上的结构: customer.site.com system/ .htaccess如下所示: RewriteEngine on RewriteCond% {HTTP_HOST} ^ client.site.com $ [OR] RewriteCond% {HTTP_HOST} ^ www.client.site.com $ RewriteRule ^ (. *) $ www.site.com/system/$1?customer=customer [P] 目标是在client.s

我拥有服务器上的结构:

customer.site.com
system/
.htaccess如下所示:

RewriteEngine on
RewriteCond% {HTTP_HOST} ^ client.site.com $ [OR]
RewriteCond% {HTTP_HOST} ^ www.client.site.com $
RewriteRule ^ (. *) $ www.site.com/system/$1?customer=customer [P]

目标是在client.site.com.br内显示目录www.site.com.br/system/的内容,但不更改url,但它不起作用。

您根本不需要.htaccess,如果可能,请避免使用它

撤销代理

在“client.site.com.br”的virtualhost中,只需使用ProxyPass:

ProxyPass / https://www.site.com.br/system/
ProxyPassReverse / https://www.site.com.br/system/
.htaccess中的等价项(如果您坚持):


client.site.com.br
www.site.com
DocumentRoot
值是什么?你好,anubhava。我在htaccess方面没有太多经验。你能帮我吗?对不起,我用的是谷歌翻译。你可以尝试将
www.site.com.br
DocumentRoot
目录更改为
/path/system/
。这样,您就不需要在URL中键入“system”。您需要在域的Apache VirtualHost指令中进行此更改。我更改为
RewriteRule^(.*)$/httpdocs/system/?$1?Customer=Customer[P]
以及
RewriteRule^(.*)$/httpdocs/system/?$1?Customer=Customer[QSA,P]
,我也尝试过这种方式`重写规则^(.*)$/system/?$1?Customer=Customer[P]
RewriteRule^(.*)/system/?$1?Customer=Customer[QSA,P]`但是给出了400个错误的请求。你能发布
VirtualHost
client.site.com.br
www.site.com
RewriteRule ^(.*) https://www.site.com.br/system/$1 [P,L]