Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

codeigniter working fine on local but not on web server. 404 Error

Tags:

codeigniter

Codeigniter is working fine on local server but not on web server.

I used XAMPP for the development on local.

I am using Parallels Plesk Panel 11.0.9 for Microsoft Windows.

404 error page of codeigniter is not loading. Url is loadind 404 error page of the server. I have removed all .htacces rewrite rules of root directory and included index.php. Still it isn't working.

Searched alot but couldn't find right solution

Directory for codeigniter folders(site, application, system)

is

mysite/httpdocs/demo/test/

Base url in mysite/httpdocs/demo/test/application/config/config.php

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

In mysite/httpdocs/demo/test/application/.htaccess

Deny from all

Envoirment set in index.php (mysite/httpdocs/demo/test/site/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';

In mysite/httpdocs/demo/test/site/.htaccess

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

In mysite/httpdocs/demo/test/application/config/routes.php

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

I am giving url mysite/demo/test/site and its giving 404 error page of web server not of codeigniter

Where am I wrong here?

like image 841
Kits Avatar asked Jul 13 '13 13:07

Kits


People also ask

Why is Codeigniter 404 not found?

404 Not Found is the HTML error code that indicates a particular situation in which the connection between the server and the client is working correctly, but the server could not find the resource requested by the client. The underlying causes of the error are several, but the general process is similar in all cases.

What does the requested URL was not found on this server?

THE requested URL was not found on this server or the HTTP 404 Not Found Error means that the webpage You were trying to reach could not be found on the server. It may be possible that that page you are accessing is moved to another URL or removed.


1 Answers

I contacted my host. They said that there was a problem in php handler.

Apart from this IIS doesn't read .htaccess file, Instead I make a file web.config and replace with .htaccess in mysite/httpdocs/demo/test/site/

Content of web.config file is

<?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>

Now the website is up and running. Thanks for the support.

like image 67
Kits Avatar answered Sep 27 '22 16:09

Kits