CodeIgniter Forums
Homepage shows up after clicking any link - routing problem? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Homepage shows up after clicking any link - routing problem? (/showthread.php?tid=11320)



Homepage shows up after clicking any link - routing problem? - El Forum - 09-03-2008

[eluser]Unknown[/eluser]
Hi,

My website (http://myjugaad.in/) is hosted on a shared hosting account (hostgater). Till last week it was working perfectly but now suddenly there is a very funny error showing up. If you go to http://myjugaad.in/ and click any link, it just reloads the homepage. For example, http://myjugaad.in/about shows homepage when it should show the about page. However, if you insert index.php in he URL, the right page is shown (http://myjugaad.in/index.php/about). Earlier every URL was accessible without index.php

Now how can suddenly this thing could change? I have checked .htaccess, folder permissions, script permissions, everything seems to be fine.

Please help.

-Paras


Homepage shows up after clicking any link - routing problem? - El Forum - 09-03-2008

[eluser]Pascal Kriete[/eluser]
If you didn't make any changes, it sounds like your host may have changed something.

I'm guessing the culprit is either htaccess or the uri_protocoll setting in your config.
A possible solution, since it works with a ?, is to just add that to your RewriteRule:
Code:
# if you had this:
RewriteRule ^(.*)$ index.php/$1 [L]

# turn it into this:
RewriteRule ^(.*)$ index.php?/$1 [L]

Let us know how that goes.


Homepage shows up after clicking any link - routing problem? - El Forum - 09-04-2008

[eluser]Unknown[/eluser]
Thanks a ton! It worked. Can you tell why adding a '?' worked? It is the problem with the way URL is passed to index.php?


Homepage shows up after clicking any link - routing problem? - El Forum - 09-04-2008

[eluser]Bramme[/eluser]
adding the ? is the same thing as index.php? Wink


Homepage shows up after clicking any link - routing problem? - El Forum - 09-04-2008

[eluser]phpoet[/eluser]
You can check to make sure that mod_rewrite is loaded by creating a <?php phpinfo() ?> page then looking in the apache2handler section under "Loaded Modules". If do not see mod_rewrite then that may be the problem.

Also, for what it's worth, this is the .htaccess file I usually use.

Code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1