【发布时间】:2011-11-28 20:04:19
【问题描述】:
我的问题很简单。
我的根目录中有几个文件夹:
[folder1]
[folder2]
[folder3]
我的域类似于:http://johndoe.net
我将我的网站保存在 [folder1] 中,所以基本上我通过输入 http://johndoe.net/folder1
来访问它我的目标是这样的:
我想输入 http://johndoe.net 并得到 http://johndoe.net/folder1 的内容,但地址必须保留 http://johndoe.net
我想输入 http://johndoe.net/folder1 并查看我的网站,但我的地址必须更改为 http://johndoe.net
看起来很简单,但经过几个小时的搜索,我没有找到解决方案。
到目前为止,我唯一实现的就是通过放置以下内容从 http://johndoe.net 重定向到 http://johndoe.net/folder1我的根目录中的 .htaccess 中的代码:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^johndoe\.net$ [OR]
RewriteCond %{HTTP_HOST} ^www\.johndoe\.net$
RewriteRule ^/?$ "http\:\/\/johndoe\.net\/folder1\/" [R=301,L]
当我输入 http://johndoe.net 时,我的地址栏中会出现 http://johndoe.net/folder1
但我需要保留我的地址 http://johndoe.net
谁能帮我解决这个问题?
【问题讨论】:
标签: .htaccess url directory url-rewriting subdirectory