【发布时间】:2015-09-18 21:36:11
【问题描述】:
我知道还有很多其他类似的问题,我尝试了其中一些,但没有运气。
我有一个名为 test.com 的网站,当有人搜索 test.com 以显示 test.com/home 中的内容时,我需要在 uerl 中没有主页。
目前我的 htaccess 文件如下所示:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule /(.*) home/$1 [L]
RewriteRule /home/(.*) /$1 [L,R=302]
RewriteOptions inherit
RewriteCond %{HTTP_HOST} ^test\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.test\.com$
但是当我输入 test.com 时,它会显示文件夹列表,而不是 home 内的内容。
我做错了什么?
谢谢
【问题讨论】:
-
这个 htaccess 在哪里?
-
我正在使用 cpanel,它位于 public_html 文件夹中
标签: regex apache .htaccess mod-rewrite redirect