从xamp中的codeigniter中删除index.php
我尝试了很多答案,但还是遇到了404恐怖墙。我在Windows7上使用xamp堆栈。mod_重写已启用 我将htaccess文件放在主“codeigniter”目录中,即包含应用程序、系统和用户指南的目录。我应该把它放在应用程序目录下吗?有视图/model/config/etc的那个 这是我当前的.htaccess文件:从xamp中的codeigniter中删除index.php,php,.htaccess,codeigniter,xampp,Php,.htaccess,Codeigniter,Xampp,我尝试了很多答案,但还是遇到了404恐怖墙。我在Windows7上使用xamp堆栈。mod_重写已启用 我将htaccess文件放在主“codeigniter”目录中,即包含应用程序、系统和用户指南的目录。我应该把它放在应用程序目录下吗?有视图/model/config/etc的那个 这是我当前的.htaccess文件: RewriteEngine On # Put your installation directory here: # If your URL is www.example.c
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]
访问作品
访问并不重要
我的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
所以它似乎没有选择正确的codeigniter重定向?不确定?尝试将htaccess的最后一行更改为:
RewriteRule .* index.php/$1 [L]
还可以尝试将配置文件中的请求方法从
AUTO
更改为request\u URI
您在apache中启用了mod_rewrite吗?首先创建.htacess文件并将下面的代码粘贴到该文件中
重新启动发动机
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'] = '';
$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'] = '';
$config['index_page'] = '';
首先,在XAMPP中启用apache的“重写模块”
如果您使用的是XAMPP或WAMP软件包,那么您将在以下位置找到该文件:
{xampp_dir}/apache/conf/httpd.conf
{wamp_dir}/apache/conf/httpd.conf
找到下面一行并删除“#”符号
实际上,我们可以通过XAMPP弹出菜单:Apache->Apache模块->重写模块来执行upper,然后选择它以启用它
其次,我们需要通过以下方式更改htaccess:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
我一次又一次地面临同样的错误,但经过一点研究,我找到了解决办法。
<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>
希望这会有所帮助。为什么要对一个2年前的答案发表评论?我已经将其标记为删除