【问题标题】:Reinstalled WAMP now can't open my project redirects to index.php重新安装的 WAMP 现在无法打开我的项目重定向到 index.php
【发布时间】:2015-12-19 00:01:11
【问题描述】:

我刚刚重新安装了 wamp 并试图打开我的 CI 项目。我打开我的项目的默认页面,但是当我单击任何链接时,它会重定向到 wamp 的项目列表页面。假设默认页面是登录,然后它会打开,但是当我点击登录时,它会将我重定向到 wamp 的默认索引页面,我搜索了堆栈,发现将其从 true 更改为 false 可能会有所帮助。

$suppress_localhost = false;

但这对我不起作用。我认为可能的原因可能是我在 Codeigniter 项目中的 .htaccess 文件。这是它的代码:

<IfModule mod_rewrite.c>
    RewriteEngine On
    # !IMPORTANT! Set your RewriteBase here and don't forget trailing and leading
    #  slashes.
    # If your page resides at
    #  http://www.example.com/mypage/test1
    # then use
    # RewriteBase /mypage/test1/
    RewriteBase /crm/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
  </IfModule>

  <IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
  </IfModule>

请帮我解决这个问题。

【问题讨论】:

  • 修改后是否重启了wamp服务器?
  • 默认情况下 WAMP 的 Apache 重写模块是关闭的。您是否尝试过开启并重新启动服务?
  • 假设它是你认为的.htaccess文件,你的.htaccess文件是否被正确执行并重写为index.php?尝试制作一个测试文件test.php,如果您在.htaccess 文件中更改index.php 的第一个实例,您的请求是否正确重写为test.php?如果没有,如果你尝试一下 ErrorDocument 测试呢?测试应该告诉我们是否启用了 mod_rewrite.c。
  • 是的,我做到了@BaDDeveloper
  • @DNReNTi 我没有,安装后让我试试

标签: php .htaccess codeigniter redirect wamp


【解决方案1】:

默认情况下,WAMP 的 Apache 重写模块是关闭的。尝试打开它,然后重新启动服务。您可以在托盘菜单(Apache -> Apache 模块)中打开模块,或在 httpd.conf 文件中取消注释此行:“LoadModule rewrite_module modules/mod_rewrite.so”。希望对您有所帮助。

【讨论】:

    猜你喜欢
    • 2016-07-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多