htaccess的重写规则子目录,然后隐藏的网址是什么?子目录、重写、规则、网址

2023-09-02 20:40:39 作者:不离不弃、纯属ル戏

我有一个名为sub.domain2.com子域,我想指出domain1.com/folder~~V /

I have a subdomain called sub.domain2.com which I want to point to domain1.com/folder/

我已经建立了一个A记录指向sub.domain2.com到domain1.com和重写规则,以点子域的子目录:

I have set up an A record to point sub.domain2.com to domain1.com and a rewrite rule to the point the subdomain to the subdirectory:

RewriteCond %{HTTP_HOST} sub.domain2.com$
RewriteRule (.*) http://sub.domain2.com/folder/$1 [L]

不过,我不希望子目录/文件夹/显示了它当前的网址是什么?

However I don't want the subdirectory /folder/ showing in the URL which it currently is?

谢谢 亚历克斯

推荐答案

删除的http://.../ ,因为这会迫使外部重定向

remove http://.../ because it will force external redirect.

RewriteCond %{HTTP_HOST} sub.domain2.com$
RewriteRule (.*) /folder/$1 [L]
 
精彩推荐
图片推荐