【问题标题】:Removing of index.php in CodeIgniter not working in Laragon在 CodeIgniter 中删除 index.php 在 Laragon 中不起作用
【发布时间】:2019-05-14 07:40:05
【问题描述】:

我想从 CodeIgniter 的 URL 中删除 index.php

我在 CodeIgniter 中编辑了.htaccess 文件并应用了规则;它在使用 WampServer 的 Web 环境设置中符合预期,但在使用 Laragon 时失败。

问题可能与 Laragon 环境有关,但我不知道如何解决。

如何让它在 Laragon 环境中工作?

【问题讨论】:

  • 你能把你的.htaccess文件放在这里吗
  • 检查 laragon 中的 mod_rewrite 启用
  • Laragon 不使用 Nginx 吗?在这种情况下,您的 htaccess 文件根本不会被使用,因为它是一个 Apache 文件。
  • mod_rewrite 在 laragon 中启用,我已经检查过了,.htaccess 也很好,因为它在 wamp 服务器中正常工作

标签: .htaccess laragon


【解决方案1】:

C:\laragon\etc\apache2\sites-enabled 中,您将在工作目录中找到 laragon 的所有 v-hosts。

当您找到 codeigniter 并打开编辑它时,您将看到一个普通的 apache VirtualHost

更改此行:<Directory "C:/workspace/my_project">

到:<Directory "C:/workspace/my_project/index.html">

重命名 laragon .conf 文件并从文件名中删除 auto.

重启一切。

小心打开正确的 v-host。 Laragon 创建了 2 个 v-host,其中 1 个在设置中定义了您的扩展名,另外一个使用 .com 扩展名。

编辑:

<VirtualHost *:80> 
    DocumentRoot "C:/laragon/www/gmap_polygons/application/""
    ServerName gmap_polygons.dev 
    ServerAlias *.gmap_polygons.dev 
    <Directory "C:/workspace/woo-backend-laravel/application/">
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

# If you want to use SSL, enable it by going to Menu > Apache > SSL > Enabled

【讨论】:

  • 我在该文件夹中找到了我的项目的 .conf 文件启用了站点,我打开了它,按照您提到的重命名目录名称,重新启动所有内容,但它不起作用
  • 你能像上面那样修改 DocumentRoot 以包含 index.html,然后重新启动吗?另外你确定是你想绕过的 index.html 而不是 index.php?
  • 让我检查一下
  • 我也修改了 DocumentRoot。当我在不包含 index.php 的情况下运行它时,它仍然显示 404 not found,它会自动从 .conf 文件中删除 index.html
  • 我的错,更改后请从 conf 文件名中删除 auto
猜你喜欢
  • 2021-04-11
  • 2014-08-12
  • 2013-12-29
  • 2019-01-14
  • 2020-02-10
  • 2018-07-12
  • 1970-01-01
  • 2014-08-19
  • 1970-01-01
相关资源
最近更新 更多