php - 从 xampp 的 codeigniter 中删除 index.php

标签 php .htaccess codeigniter xampp

我已经尝试了很多答案,但不断遇到好的 ol,404 恐怖墙。我在 Windows 7 上使用 xamp 堆栈。 mod_rewrite 已启用。

我把htaccess文件放在主“codeigniter”目录下,也就是有application、system和user_guide的目录。我应该把它放在应用程序目录下吗?带有 View /模型/配置/等的那个?

这是我当前的 .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

所以它似乎没有选择正确的 codeigniter 重定向?不确定?

最佳答案

首先创建 .htacess 文件并粘贴下面的代码 RewriteEngine 开启

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'] = '';

享受

关于php - 从 xampp 的 codeigniter 中删除 index.php,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9619831/

相关文章:

php - Wamp Server 3.0.6 作为本地主机正常工作,但不能在网络上工作

html - 有没有办法用 htaccess 文件更改页面的内容?

apache - 如何从 FilesMatch 中排除目录

mysql - 根据选择框值需要在 codeigniter 中显示 View 表

php - 调试MYSQL语法错误

php 从文本中删除内容类型

php - 我们如何在 ConfigureIT 管理或数据面板的产品模块列表中显示产品价格的总计

codeigniter - 如何将 FFmpeg 与 codeigniter 连接

php - 使用 SimpleHTMLDOM 在 PHP 中解析 HTML iFrame SRC

.htaccess - 如何隐藏所有控制台错误