简体   繁体   中英

Codeigniter all urls are being routed to default controller

I'm hoping someone can give me a suggestion on how to fix this. I've developed a codeigniter app and just uploaded it to a godaddy subdomain. It was working perfectly locally, however when running it at ci.site.com , all urls are being routed to the default controller. For instance, say my default controller is set to $route['default_controller'] = 'home/index'; . If I go to ci.site.com , the home controller loads the index method just fine, however when going to ci.site.com/users/index , I'm routed back to home/index even though the url reads ci.site.com/users/index .

This is what my /.htaccess looks like, the CI app and .htaccess are in document root :

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

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

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

I've deployed several CI apps and have never run into this problem. Both my base_url and index_page config parameters are correct, I just can't seem to figure it out. Any suggestions would be much appreciated.

I just ran into this. The server you are now on likely does not have the module mod_rewrite enabled. Thus, the IfModule !mod_rewrite.c is TRUE.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM