我试过很多答案,但总是遇到好的404恐怖墙。我在Windows7上使用的是example堆栈。mod_rewrite已启用。
我将htaccess文件放在主"codeigniter"目录中,即包含应用程序、系统和用户指南的目录。我应该把它放在应用程序目录下吗?有视图/model/config/等的那个。?
这是我当前的.htaccess文件:
RewriteEngine On
# Put your installation directory here:
# If your URL is www.example.com/, use /
# If your URL is www.example.com/site_folder/, use /site_folder/
RewriteBase /website/codeigniter/
# Do not enable rewriting for files or directories that exist
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# For reuests that are not actual files or directories,
# Rewrite to index.php/URL
RewriteRule .* index.php/$0 [PT]
访问http://localhost/website/codeigniter/index.php/welcome作品访问http://localhost/website/codeigniter/welcome不是
我的config.php有
$config['base_url'] = 'http://localhost/website/codeigniter/';
$config['index_page'] = '';
非常感谢您的帮助!
错误为:
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.
Error 404
更新哦,我只是想看看apache日志,得到这个错误:
[Thu Mar 08 18:28:25 2012] [error] [client ::1] File does not exist: C:/xampp/htdocs/website/codeigniter/welcome
所以它似乎没有选择正确的代码点火器重定向?不确定?
首先创建.htaccess文件并将下面的代码粘贴到上的重写引擎
RewriteCond $1 !^(index'.php|resources|robots'.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
然后转到配置文件
$config['index_page'] = 'index.php';
更改为
$config['index_page'] = '';
并享受
试试这个:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
$config['index_page'] = 'index.php';
更改为
$config['index_page'] = '';
您在apache中启用了mod_rewrite吗?
我一次又一次地面临同样的错误,但经过很少的研究,我找到了解决方案
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /Codeigniter_start/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /Codeigniter_start/index.php/$1 [L,QSA]
</IfModule>
重要的一点是,the project folder
。就像我使用RewriteBase /Codeigniter_start/
和RewriteRule ^(.*)$ /Codeigniter_start/index.php/$1 [L,QSA]
一样。
同样从配置文件index_page更改如下。
$config['index_page'] = '';
希望这会有所帮助。
尝试将htaccess的最后一行更改为:
RewriteRule .* index.php/$1 [L]
还可以尝试将配置文件中的请求方法从AUTO
更改为REQUEST_URI
。
首先,在XAMPP 中启用apache的"重写模块"
如果您正在使用XAMPP或WAMP软件包,那么您将在以下位置找到该文件:
{xampp_dir}/apache/conf/httpd.conf
{wamp_dir}/apache/conf/httpd.conf
找到以下行并删除"#"标志。
LoadModule rewrite_module modules/mod_rewrite.so
实际上,我们可以通过XAMPP弹出菜单:Apache->Apache模块->重写模块,然后选择它以启用它。
其次,我们需要通过以下方式更改htaccess:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]