使用 htaccess 跳到子文件夹,对用户不可见
(抱歉。关于 SO 的 .htaccess 问题太多,我读得越多,我就变得越困惑。)
目前我拥有:
- www.mydomain.com
- www.mydomain.org
- www .mydomain.net
,但只有第一个获得真正的流量。所有内容都指向我的 /public_html/
文件夹。
我想开始测试网站重新设计,该网站(并且永远)位于 /public_html/SUB/
中。
当我进行重新设计时,我希望 www.mydomain.org
指向 /public_html/SUB/
,然后一旦完成,我想还要添加 .com
和 .net
域。
棘手的问题是,我不希望访问者在其 URL 中看到 /SUB/
文件夹。我希望此后能够永远被有效地掩盖。
因此,在我的重新设计完成之前:
- www.mydomain.com 转到位于
/public_html/
的旧网站 - www.mydomain.org 转到位于
/public_html/SUB/ 但您在 URL 中看不到它,
谢谢。
(My apologies. There are a plethora of .htaccess questions on SO and the more I read the more confused I've become.)
Currently I own:
- www.mydomain.com
- www.mydomain.org
- www.mydomain.net
though only the first gets any real traffic. All are pointed to my /public_html/
folder.
I'd like to begin testing a site redesign, which is (and forever will be) located in /public_html/SUB/
.
I'd like www.mydomain.org
to point to /public_html/SUB/
while I work on the redesign, and then once I'm done I'd like to add the .com
and .net
domains as well.
The sticky point is, I don't want visitors to see the /SUB/
folder in their URL. I want that to be effectively masked forever after.
So, before my redesign is complete:
- www.mydomain.com goes to the old site at
/public_html/
- www.mydomain.org goes to the new site at
/public_html/SUB/
but you can't see it in the URL
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一旦测试完成。只需将 VirtualHost 的文档根更改为
或者,如果您无权访问 httpd.conf 或由于某种原因无法更改文档根。尝试在您的根
.htaccess
中执行以下操作Once tests are done. Just change document root of you VirtualHost to
Or if you don't have access to httpd.conf or can't change document root because of some reason. Try following in your root
.htaccess