CodeIgniter - 删除index.php

2023-12-23

我在删除 CI 安装上的 index.php 时遇到一些问题,当前使用的 .htaccess 如下:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule> 

我的 CI 安装从 public_html 目录返回,我已将配置更改为

$config['index_page'] = "";

所以我的 CI 如下所示

/core-1.7.3
/public_html/index.php

当我输入 url 时,我得到 404,但是当我将 index.php 放在它前面时,它工作正常:S

我很困惑


你好 我已经安装了 1.7.3 并且这个 .htaccess 使用这个 URL-

/CodeIgniter_1.7.3/public_html/welcome

.htaccess->

RewriteEngine On

RewriteCond $1 !^(index\.php|resources|robots\.txt)

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php/$1 [L,QSA] 
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

CodeIgniter - 删除index.php 的相关文章

  • stdClass 类的对象无法转换为字符串

    我现在在使用 PHP 时遇到问题 收到此错误 Object of class stdClass could not be converted to string当我在我的网站中运行这部分代码时发生错误 function myaccount
  • Codeigniter:对未定义函数 mysqli_init() 的致命错误调用

    我刚刚更改了服务器并遇到以下错误 Fatal error Call to undefined function mysqli init in home blacktwitter public html system database dri
  • 在 Codeigniter 中加载 javascript

    对于我们的 Code Igniter 应用程序 我们在结束 body 标记之前加载所有 javascript 所以在我们的控制器中我们有 this gt load gt view head this gt head this gt load
  • 如何在codeigniter中引用数据库连接?

    如何在 CodeIgniter 数据库处理程序对象中手动调用 PHP 数据库函数 如何检索连接 dbc 或者调用类似的函数mysql real escape string dbc variable 您可以调用任何 mysql 本机函数并访问
  • 多个where条件codeigniter

    如何将此查询转换为活动记录 UPDATE table user SET email email last ip last ip where username username and status status 我尝试将上面的查询转换为 d
  • 如何将 .env 添加到 codeigniter?

    我尝试按照以下步骤使 php 连接到 Outlookhttps learn microsoft com en us outlook rest php tutorial https learn microsoft com en us outl
  • 如何在 CodeIgniter 中加载类/库?

    我有一个图书馆叫lib 其中包含一个名为nusoap php 我已经将lib放入文件夹中应用程序 库 当我尝试加载它时 出现以下错误 An Error Was Encountered Unable to load the requested
  • Codeigniter - 出现 404 Not Found 错误

    我们在 godaddy 有两个托管套餐 我们的实时网站使用以下 htaccess 文件运行良好 无需在 url 中使用 index php 即可访问网站 RewriteEngine On RewriteCond REQUEST FILENA
  • 如何设置Codeigniter上传库在本地机器的上传路径?

    我将以下路径设置为 Codeigniter 附带的上传库的 upload path this gt upload config upload path uploads working 该路径在远程服务器上运行良好 但是 当我在本地调试时 它
  • 在 CodeIgniter 中添加新页面

    对于我对 CodeIgniter 和 MVC 系统的无知 我提前表示歉意 我正在帮助一位家庭成员处理他们的商业网站 到目前为止 我已经能够仅通过逻辑来完成大部分所需的更改 但现在我已经走进了死胡同 我不打算继续支持他们 因为我显然不是 Co
  • Codeigniter子域路由

    我正在尝试在 CodeIgniter 框架上运行的网站上设置博客脚本 我想在不对现有网站代码进行任何重大代码更改的情况下执行此操作 我认为创建一个指向另一个控制器的子域将是执行此操作的最干净的方法 我设置新设备所采取的步骤Blog涉及控制器
  • 检查文件是否要上传?代码点火器

    我有一个带有很少输入和一个文件输入的表单 我想检查文件输入是否为空 如果为空则不要尝试上传 如果不是则尝试上传 我尝试过这样的事情 upld file this gt upload gt data if empty upld file Up
  • 在 PHP Codeigniter 中向 form_submit 添加一个类

    我正在尝试在 PHP Codeigniter 中向 form submit 添加一个类 我正在使用以下代码 attributes1 array class gt btn btn danger echo form submit loginSu
  • CodeIgniter 2.1.0 的会话库中是否存在任何已知错误?为什么我会被踢出去? [关闭]

    这个问题不太可能对任何未来的访客有帮助 它只与一个较小的地理区域 一个特定的时间点或一个非常狭窄的情况相关 通常不适用于全世界的互联网受众 为了帮助使这个问题更广泛地适用 访问帮助中心 help reopen questions 我正在开发
  • 如何解决错误:消息:fsockopen():无法连接到 ssl://smtp.gmail.com:465(连接被拒绝)

    我在用着代码点火器我创建了一个电子邮件功能来将电子邮件发送到特定的电子邮件 ID public function email email config protocol smtp config smtp host ssl smtp gmai
  • CodeIgniter 控制器构造函数

    我对 codeigniter 很陌生 我想知道控制器中构造函数的含义是什么 我在 codeigniter 教程中看到以下代码 class upload extends CI Controller function construct par
  • 测试 CodeIgniter 会话变量的正确方法是什么?

    获取以下代码片段 测试确保会话变量不为空的最佳方法是什么 如果稍后在我的脚本中 我调用以下内容 第一个打印正确 但在第二个我收到消息 未定义的变量 已登录 我尝试过使用 empty and isset 但两者均未成功 我还尝试使用向后执行
  • Codeigniter $this->db->reconnect();用法

    I m not自动加载数据库 因为我的应用程序的大多数页面don t需要数据库处理 否则整个事情会变慢 我想要做的是 当数据库已经存在时 不要建立与数据库的新连接 而是使用它而不是打扰服务器数据库 那么我该如何实施 this gt db g
  • 从数据库而不是配置文件中读取 CodeIgniter 配置值

    您可能知道 当您使用 CI 创建新项目时 您必须手动输入基本网址 加密密钥在config config php中 我正在努力克服这个问题 因此正在寻找一种方法read那些价值观而是从数据库中 为客户进行安装并设置时间作为一个整体decrea
  • 从 CodeIgniter 中的 URL 捕获哈希值 (#)

    我有一个看起来像的网址 mysite com transactions view 123456 效果很好 但是我的客户现在希望在 url 中包含 hashbang mysite com transactions view 123456 现在

随机推荐