2013-07-13 73 views
5

Codeigniter在本地服务器上工作正常,但在Web服务器上无法正常工作。codeigniter在本地但在Web服务器上正常工作。 404错误

我用XAMPP进行本地开发。

我对Microsoft Windows使用Parallels Plesk Panel 11.0.9。

codeigniter的404错误页未加载。 Url是服务器的loadind 404错误页面。我已经删除了所有.htacces根目录的重写规则,并且包含index.php它仍然无法正常工作。

搜索了很多,但无法找到合适的解决方案

的笨文件夹(网站,应用程序,系统)

的mysite/httpdocs资料/演示

mysite/httpdocs/demo/test/ 

基本URL目录/test/application/config/config.php

$config['base_url'] = 'http://mysite/httpdocs/demo/test/site/'; 

mysite的/的httpdocs /演示/测试/应用/ htaccess的

Deny from all 

Envoirment中的index.php集(mysite的/的httpdocs /演示/测试/站点/ index.php的

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'; 

的mysite/httpdocs资料/演示/测试/网站/的.htaccess

   <IfModule mod_rewrite.c> 
          Options +FollowSymLinks 
          RewriteEngine on 
          RewriteCond %{REQUEST_FILENAME} !-f 
         RewriteCond %{REQUEST_FILENAME} !-d 
          RewriteRule ^(.*)$ index.php/$1 [L] 
       </IfModule> 

的mysite/httpdocs资料/演示/测试/应用/配置/ routes.php文件

  $route['default_controller'] = "page"; 
      $route['404_override'] = 'page'; 
      $route['article/(:num)/(:any)'] = 'article/index/$1/$2'; 

我给URL 的mysite /演示/测试/网站它为Web的404错误页面服务器没有codeigniter

我在哪里错了?

+0

您是否可以使用包含'index.php'的网站访问该网站?例如'mysite/demo/test/site/index.php' –

+0

不,我也试过。 – Kits

+0

尝试'$ config ['base_url'] ='';' – Shomz

回答

10

我联系,我的主人。他们说php handler中存在一个问题。

除了这个IIS不读.htaccess文件,而不是我做一个文件web.config并与.htaccess取代的mysite/httpdocs资料/演示/测试/网站/

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> 

现在网站启动并运行。 感谢支持

+0

非常感谢。它为我工作 –

+0

我浪费了我整整一天,终于找到解决方案,非常感谢。 – developersaumya

0

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

检查项目的根目录,如果你有.htaccess文件,如果你有机会到服务器,可能如果mod_rewrite启用(假设你使用的是Apache)以及检查过。这可能是一个URL重写问题。

编辑1

好吧,现在我看到你在那里有一个.htaccess文件。如何在您的httpd中指示<Directory>?conf或者通过<VirtualHost>进行设置?

EDIT 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> 
+0

我没有碰过那样的东西。只需在codeigniter中创建一个网站并将其上传到网络服务器并使用** Parallels Plesk Panel ** – Kits

+0

它不起作用 – Kits

+0

我没有使用Parallels Plesk Panel的实际经验,但正如我所看到的那样,似乎有错误这里。看到这个:case'http:// mysite/httpdocs/demo/test/site'不应该是URL。这个项目的域名是什么?在当地它可能工作,但不在现场。 – dqlopez

相关问题