htaccess的重写规则子目录,然后隐藏的网址是什么? [英] htaccess rewrite rule to subdirectory and then hide the url?

查看:126
本文介绍了htaccess的重写规则子目录,然后隐藏的网址是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为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]

这篇关于htaccess的重写规则子目录,然后隐藏的网址是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆