以下htaccess代码的结果是什么?

时间:2012-02-27 09:32:27

标签: .htaccess

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?$1 [L]

我无法测试此htaccess代码。例如,我的输出网址是:http://www.domain.com/index.php?mod=category,结果可能是什么?

1 个答案:

答案 0 :(得分:1)

它使index.php在URL中可选,这意味着如果您转到:

http://www.domain.com/?mod=category

这也应该可以正常工作。

它通常由实现Front Controller Pattern的框架使用。使用前端控制器设计模式,Web应用程序的所有请求都通过index.php路由,因此,由于它总是需要,因此可以使用上面的htaccess规则来完全隐藏它,因为它很明显。

相关问题