【发布时间】:2014-02-24 09:00:36
【问题描述】:
我正在学习本教程:
http://www.phpro.org/tutorials/Model-View-Controller-MVC.html
本教程指出您应该使用 htaccess 文件。但是,Apache2 文档建议您将 .htaccess 规则输入到标准配置文件中以获得更好的性能。
我在 /etc/apache2/sites-available/default 工作。
这是我目前所拥有的:
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order Deny,Allow
Deny from all
</Directory>
<Directory /var/www/>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?rt=$1 [L,QSA]
</Directory>
<Location /index.php>
Order Allow,Deny
Allow from All
</Location>
通过这些规则,可以访问 index.php,但 index.php?rt=blog 仍然有效,而 index/blog 或 /blog 无效。我做错了什么?
【问题讨论】:
标签: php apache .htaccess mod-rewrite url-rewriting