4

我有一个这样安排的网站:

/关于

/css/

/index/index.php

/js/

/index.php

index.php 使用 PHP 重定向到 index/index.php

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

4

2 回答 2

3

如果你有 mod_rewrite 这应该工作:

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

这只会匹配 / (它认为是空的)并在内部重定向到 /index/index.php

于 2010-02-08T14:52:11.687 回答
0

下面将/显示 index/index.php 作为它的索引文件

DirectoryIndex index/index.php

只需将它放在 .htaccess for /

于 2010-02-08T14:22:54.160 回答