Apache - 使用.htaccess重定向/文件夹到/folder/index.php

时间:2013-03-23 14:59:00

标签: apache redirect directory rewrite invisible

当有人访问时

http://127.0.0.1/something

我想将他重定向到

http://127.0.0.1/something/index.php

使用.htaccess。

  1. 我该怎么做?
  2. 是否可以在不向用户显示重定向的情况下执行此操作,例如YouTube(YouTube.com/user/channel/videos /)
  3. 提前致谢!

1 个答案:

答案 0 :(得分:0)

我终于知道该怎么做了。

警告:我没有使用mod_rewrite的经验,所以这可能不是最佳解决方案。它适用于我。

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUESTFILENAME} !-f
RewriteRule ^(.*)/$ /$1/index.php [L]
</IfModule>