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]