mod-rewrite RewriteBase无法从root正常工作

时间:2016-06-17 10:44:46

标签: php regex apache mod-rewrite xampp

您好我一直在关注Codecourse的YouTube频道上的"Build a PHP MVC Application"教程。

我已将项目移至根目录(htdocs) 现在,当我加载http://localhost时,我看到的是默认的apache文件夹索引。

我的文件按此组织:

htdocs
->app
->public
->.htaccess

.htacces包含:

Options -MultiViews
RewriteEngine On

RewriteBase /public/

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]

编辑:如果我去localhost / home(我设置的控制器之一),它会正确加载页面

1 个答案:

答案 0 :(得分:0)

可擦写部分http://localhost/为空,因此不匹配(。+)。 它会匹配(。*)。