apache - Codeigniter 网站上的链接在新服务器上损坏

标签 apache .htaccess codeigniter

我最近将我的 codeigniter 网站切换到了新的虚拟主机,现在该网站上的所有链接都已损坏。每次我点击其中一个网站时,只会重定向到index.php。 一切都在旧服务器上运行,没有任何问题。我对服务器不太了解,问题是它是共享托管,我无权访问/etc/apache2 目录中的conf文件。

我的 .htaccess 文件是

<IfModule mod_rewrite.c>

    RewriteEngine On
    RewriteBase /

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]

</IfModule>

<IfModule !mod_rewrite.c>

    # Without mod_rewrite, route 404's to the front controller
    ErrorDocument 404 /index.php

</IfModule>

任何帮助将不胜感激。谢谢!

最佳答案

它可能会将所有内容重定向到 /index.php 因为您已将 404 错误文档路由到它:

ErrorDocument 404 /index.php

这似乎表明您的新网络主机上的 mod_rewrite 未启用。您需要联系支持人员并了解如何打开重写模块。

关于apache - Codeigniter 网站上的链接在新服务器上损坏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14148835/

相关文章:

javascript - .htaccess RewriteRule 在 javascript 中添加为非斜杠的多个参数

php - .htaccess PHP $_GET

javascript - 将 JavaScript 值传递给 PHP 或其他 PHP 类 (codeigniter)

django - apache的权限问题

php - .htaccess 将 IP 地址重定向到 HTTPS 域

php - MySQL服务没有自动启动

git - 在 Windows 服务器上使用 Apache 配置 Git

.htaccess - 使用 Wordpress 重写多语言网站的规则

php - 文件夹内的 CodeIgniter、NGINX 不工作

mysql - codeigniter 事件记录建议