0
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/index\.php
RewriteRule ^(.*)$ index.php?q=$1 [L]

这应该将任何 url 重写为 index.php?q={url},并且它正在工作。无论如何,http://www.domain.com/只显示一个空白页。如何将 / 重写为 index.php?(http://www.domain.co.il/index.php不要显示空白页..)

BTW:这段代码是重定向而不是重写,为什么呢?

谢谢。

4

2 回答 2

2

您需要DirectoryIndex.htaccess文件中设置:

DirectoryIndex index.php
于 2009-11-02T11:33:55.593 回答
0
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/$ index.php?q=$1 [L]
于 2009-11-02T11:42:33.613 回答