.htaccess 重定向到子文件夹并隐藏在 uri 中

.htaccess redirect to subfolder and hide in uri

我想重定向每个请求:

http://subdomain.domain.com/customer/

http://subdomain.domain.com/customer/httpdocs/web/

仍在浏览器中继续显示 http://subdomain.domain.com/customer 并使用位于 "customer" 文件夹中的 .htaccess 文件。

这是我实际的 .htaccess,重定向有效,但浏览器显示完整路径:

RewriteEngine On
RewriteRule ^$ httpdocs/web [L]

试试下面的条目:

RewriteCond %{HTTP_HOST} ^(www\.)?subdomain.domain.com RewriteRule ^/customer/(.*)$ /customer/httpdocs/web/ [PT,L,QSA]

要为您的子域重写任何内容,您可以使用此规则:

RewriteEngine On

RewriteRule ^(.*)$ httpdocs/web/ [L]

^$ 只会重写着陆页,而 .* 会匹配所有 URI。