Search code examples
codeignitercodeigniter-url

routing issue on live server codeigniter


I've developed CMS in Codeigniter which is working find on localhost on every aspect I mean I can access my client and admin using URL's on localhost but I've hosted my application on domain where I can access only main page of my CMS but on every other url it says : Not Found : The requested document was not found on this server. please consider my configurations and advice accordingly entries from config.php

$config['base_url'] = '';
$config['index_page'] = '';

my .htaccess file below

<IfModule mod_rewrite.c>
    Options +FollowSymlinks
    RewriteEngine On
    RewriteBase /cicms
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php
</IfModule> 

routes.php

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

my folder stucture is given below

cicms
.htaccess
application
    controller
        admin 
            page
            user
            dashboard
            etc
        page  //cleint
        article //client    

now on live server when i access abc.com/cicms it gives me the page controller but there are other tabs for different pages which gives me document not found error and if I try to access the admin panel like abc.com/cicms/admin/user/login it gives me document not found error P:S my login view exist I am sure please advice and one more thing everything is workging perfectly on localhost


Solution

  • actually I hosted my site on paraller plesk and it does not use apache instead they use IIS so there is no use of .htaccess file instead we need a web.config file on the root here is my web.config and its working for all of my projects hosted on parallel plesk

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