.htaccess只将root(“/”)重定向到子文件夹

时间:2010-02-08 06:54:06

标签: apache .htaccess mod-rewrite root

我有一个安排的网站:

/约

/ CSS /

/index/index.php

/ JS /

的index.php

index.php使用PHP重定向来索引/ index.php

我想创建一个.htaccess重写规则,以便在访问root时,显示/index/index.php但是保持不变等。

2 个答案:

答案 0 :(得分:2)

如果你有mod_rewrite,这应该有效:

RewriteEngine on
RewriteRule ^$ /index/index.php [L]

那只会匹配/(它看起来是空的)并在内部重定向到/index/index.php

答案 1 :(得分:0)

以下将使/ index index / index.php成为其索引文件

DirectoryIndex index/index.php

将它放在.htaccess for /