我最近从一家公司继承了一个未完成的CodeIgniter项目,该公司已将我分包完成该项目。由于无法在本地主机上查看该项目,我在前一个开发人员实现的mod_rewrite规则方面遇到了一些问题。
据我所知,所应用的规则只是为了去掉URL的"index.php"部分。该项目运行良好,因此我认为问题在于我设置examplep-httpd.conf文件的方式。根据本网站和其他来源的说明,我对httpd.conf文件进行了以下更改:
LoadModule rewrite_module modules/mod_rewrite.so
<Directory />
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
DocumentRoot "C:/Users/Me/Documents/Github"
<Directory "C:/Users/Me/Documents/Github">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
当我转到localhost并点击该项目时,我只得到一个404错误。我已经挣扎了好几天了,不知道该怎么办。你能看到我设置httpd.conf文件的方式有问题吗?谢谢你的帮助!
编辑:添加了正在使用的重写规则。
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
SetEnv ENVIRONMENT development
这可能是一个粗略的猜测,但当我查看我的Xampp apache配置时,它有
..
allow from all
Require all granted
</Directory>