codeigniter在本地服务器上工作正常,但在web服务器上工作不正常。404错误

codeigniter在本地服务器上工作正常,但在web服务器上工作不正常。404错误,codeigniter,Codeigniter,Codeigniter在本地服务器上工作正常,但在web服务器上工作不正常 我使用XAMPP进行本地开发 我正在使用适用于Microsoft Windows的Parallels-Plesk Panel 11.0.9 未加载codeigniter的404错误页面。Url是服务器的loadind 404错误页。我已删除了根目录的所有重写规则,并包含了

Codeigniter在本地服务器上工作正常,但在web服务器上工作不正常

我使用
XAMPP
进行本地开发

我正在使用适用于Microsoft Windows的Parallels-Plesk Panel 11.0.9

未加载codeigniter的404错误页面。Url是服务器的loadind 404错误页。我已删除了根目录的所有重写规则,并包含了
它仍然不起作用。

搜索了很多,但找不到正确的解决方案

codeigniter文件夹目录(站点、应用程序、系统)

mysite/httpdocs/demo/test/application/config/config.php中的基本url

在mysite/httpdocs/demo/test/application/.htaccess中

index.php(mysite/httpdocs/demo/test/site/index.php)中的环境设置

在mysite/httpdocs/demo/test/site/.htaccess中

我给出了网址mysite/demo/test/site和 web服务器的404错误页面不是codeigniter的错误页面


我哪里错了?

我还不能评论,所以我会去寻求答案

如果您有
.htaccess
文件,请检查项目根目录,如果您有权访问服务器,还可以检查是否启用了
mod_rewrite
(假设您使用的是Apache)。这可能是URL重写问题

编辑1

好的,现在我看到你有一个
.htaccess
文件在里面。您的httpd.conf中的
指令如何,或者此设置是否通过

编辑2

尝试用以下方法更改您的
.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>
    # 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>

重新启动发动机
重写基/
#删除用户对系统文件夹的访问权限。
#此外,这将允许您创建System.php控制器,
#以前这是不可能的。
#如果已重命名系统文件夹,则可以替换“系统”。
重写COND%{REQUEST_URI}^系统*
重写规则^(.*)$/index.php?/$1[L]
#当应用程序文件夹不在系统文件夹中时
#此代码段阻止用户访问应用程序文件夹
#提交人:Fabdrol
#将“应用程序”重命名为应用程序文件夹名称。
重写cond%{REQUEST_URI}^应用程序*
重写规则^(.*)$/index.php?/$1[L]
#检查用户是否试图访问有效文件,
#例如图像或css文档,如果这不是真的,它会发送
#请求index.php
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$index.php?/$1[L]
#如果我们没有安装mod_rewrite,所有404
#可以发送到index.php,一切正常。
#提交人:ElliotHaughin
ErrorDocument 404/index.php

我联系了我的主机。他们说php处理程序有问题

除此之外,IIS不读取
.htaccess
文件,而是在mysite/httpdocs/demo/test/site中创建一个
web.config
文件并替换为
.htaccess
/

web.config
文件的内容为

<?xml version="1.0" encoding="UTF-8"?>
<configuration>

<system.webServer>

    <httpErrors errorMode="Detailed" />
    <asp scriptErrorSentToBrowser="true"/>

    <rewrite>
    <rules>
        <rule name="RuleRemoveIndex" stopProcessing="true">
            <match url="^(.*)$" ignoreCase="false" />
            <conditions>
                <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
            </conditions>
            <action type="Rewrite" url="index.php/{R:1}" appendQueryString="true"/>
        </rule>
    </rules>
    </rewrite>

</system.webServer>

<system.web>
    <customErrors mode="Off"/>
    <compilation debug="true"/>
</system.web>

</configuration>


现在,该网站已启动并运行感谢您的支持

您可以访问包含
index.php
的网站吗?e、 g.
mysite/demo/test/site/index.php
不,我也试过了我尝试了所有涉及路径的方法,之后我发布了这个问题。你的主人是戈达迪吗?我没有碰任何类似的东西。只是在codeigniter中创建了一个网站并将其上传到web服务器,然后使用Parallels-Plesk Panel我没有使用Parallels-Plesk Panel的实际经验,但在我看来,这里似乎有错误。请参见:
case'http://mysite/httpdocs/demo/test/site
不应该是URL。这个项目的域名是什么?在本地,它可能工作,但在live中不工作。Plesk使用IIS服务器。因此,我删除了
.htaccess
东西。如果这是你的域名,那么你的
基本url
应该是
http://karigarifashions.com/
。这个域就是绑定在你的httpdocs中的域吗?我浪费了一整天的时间,终于找到了解决方案,非常感谢。
Deny from all
switch (dirname(__FILE__)) {
        case 'http://mysite/httpdocs/demo/test/site':
            define('ENVIRONMENT', 'development');
        break;

        default:
            define('ENVIRONMENT', 'production');
        break;
    }
          $system_path = '../system';
          $application_folder = '../application';
               <IfModule mod_rewrite.c>
                           Options +FollowSymLinks
                           RewriteEngine on
                           RewriteCond %{REQUEST_FILENAME} !-f
                         RewriteCond %{REQUEST_FILENAME} !-d
                          RewriteRule ^(.*)$ index.php/$1 [L]
              </IfModule>
           $route['default_controller'] = "page";
           $route['404_override'] = 'page';
           $route['article/(:num)/(:any)'] = 'article/index/$1/$2';
<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>
    # 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>
<?xml version="1.0" encoding="UTF-8"?>
<configuration>

<system.webServer>

    <httpErrors errorMode="Detailed" />
    <asp scriptErrorSentToBrowser="true"/>

    <rewrite>
    <rules>
        <rule name="RuleRemoveIndex" stopProcessing="true">
            <match url="^(.*)$" ignoreCase="false" />
            <conditions>
                <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
            </conditions>
            <action type="Rewrite" url="index.php/{R:1}" appendQueryString="true"/>
        </rule>
    </rules>
    </rewrite>

</system.webServer>

<system.web>
    <customErrors mode="Off"/>
    <compilation debug="true"/>
</system.web>

</configuration>