我是Web开发的新手,所以这个问题可能非常简单.
我已经安装并运行了xampp,并且正在使用netbeans最新版本.
我目前正在尝试遵循一个教程,这个教程要求我制作一些控制器,但我能成功加载的唯一页面是index.php.
我在application / controllers文件夹中创建了一个新的控制器:
<?php
class Blog extends CI_Controller {
public function index()
{
echo 'Say something';
}
}
?>
并尝试通过它访问它
http://localhost/Something/Blog
但是我收到一个错误:
Object not found!
The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.
If you think this is a server error, please contact the webmaster.
Error 404
localhost
Apache/2.4.10 (Win32) OpenSSL/1.0.1i PHP/5.6.3
附:
http://localhost/Something is loading fine.
我编辑了.htaccess文件:
RewriteEngine on
RewriteCond %(REQUEST_FILENAME) !-f
RewriteCond %(REQUEST_FILENAME) !-d
RewriteRule ." index.php/$0 [PT,L]
我一直在谷歌搜索解决方案3小时,我将不胜感激任何帮助:)
最佳答案 将.htaccess文件更改为:
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$index.php/$1 [L,QSA]
另外,尝试访问:
http://localhost/Something/index.php/Blog