使用htaccess的改变文档根目录 [英] Using htaccess to change document root

查看:442
本文介绍了使用htaccess的改变文档根目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站具有文档根目录〜/的public_html但我想所有的文件添加到〜/的public_html / WWW

My website has document root ~/public_html but i want to add all the files into ~/public_html/www

有没有办法与htaccess的做到这一点?

Is there a way to do this with htaccess?

感谢你。

推荐答案

以下行添加到该文件夹​​中的public_html的.htaccess文件:

add the following lines to the .htaccess file in the public_html folder:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain-name.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.domain-name.com$
RewriteCond %{REQUEST_URI} !folder/
RewriteRule (.*) /folder/$1 [L]

这篇关于使用htaccess的改变文档根目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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