我是codeigniter的新手.我在localhost / path / learn_ci上安装了我的codeigniter.
我已经遵循了codeigniter wiki中给出的所有步骤.这是我的.htaccess文件.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$/learn_ci/index.PHP/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.PHP
</IfModule>
我还根据需要更改了配置文件.但是当我试图访问时
我收到这个错误
“The requested URL /learn_ci/index.PHP/welcome was not found on this server”
我已经仔细检查了…… Apache中的mod_rewrite模块已启用.
RewriteBase解决方案也不起作用.难道我做错了什么??
解决方法:
正如其他人所说,请确保在apache配置或虚拟主机文件中将AllowOverride设置为All.
鉴于您已设置codeigniter的路径,您的htaccess应如下所示:
RewriteEngine On
RewriteBase /path/learn_ci
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$/path/learn_ci/index.PHP/$1 [L]
此外,请记住您使用的任何资产(img,css,js等)都使用base_url()函数或使用相对路径引用.项目的根目录是/ path / learn_ci.