Remove index.php without setting $config['index_page'] to empty string [SOLVED] - 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: Remove index.php without setting $config['index_page'] to empty string [SOLVED] (/showthread.php?tid=32773) |
Remove index.php without setting $config['index_page'] to empty string [SOLVED] - El Forum - 08-04-2010 [eluser]cseguin[/eluser] Hi all, I'm working on a app that is behaving correctly on the hosting but I'm not able to replicate this behaviour locally. Let me explain: Without touching anything in the code Code: http://127.0.0.1/item/2 returns a 404 and... Code: http://127.0.0.1/index.php/item/2 works fine On the hosting Code: http://www.onlineshop.com/item/2 works fine. The question is, why? Why does it work fine on the server and not in my machine? in config.php Code: $config['base_url'] = "http://zeus/shoponline"; here I have made the following modification: Code: $config['base_url'] = "http://127.0.0.1"; and the .htaccess file looks like this: Code: RewriteEngine On I've through all docs available about the subject and always mention to set index_page to empty string for this to work. Obviously there has to be another way. Does anyone know how is it done? Thanks. Remove index.php without setting $config['index_page'] to empty string [SOLVED] - El Forum - 08-04-2010 [eluser]bretticus[/eluser] Do your config.php files match with respect to: Code: $config['index_page'] = "index.php"; ...? Have you tried removing index.php: Code: $config['index_page'] = ""; ...per instructions? Remove index.php without setting $config['index_page'] to empty string [SOLVED] - El Forum - 08-04-2010 [eluser]cseguin[/eluser] Hi bretticus, thanks so much for replying. Well I have read your other post about the subject, so yes I have tried Code: $config['index_page'] = ""; but with no success. The curious thing is that the code in the server as it is right now Code: $config['index_page'] = "index.php"; does work without showing index.php on the url whereas in my machine does not work at all. It does not matter if I keep the variable as it is now or if I set it to "". I always get a 404 error. Whenever I click on a link from the home page I get a 404 and index.php does not appear in the url. One thing, I do not get the error when I enter into the site's home page. I get the error from there on. However, if I get the 404 error and then manually I modify the url Code: http://127.0.0.1/item/2 to... Code: http://127.0.0.1/index.php/item/2 then it works fine. any ideas? regards Remove index.php without setting $config['index_page'] to empty string [SOLVED] - El Forum - 08-04-2010 [eluser]bretticus[/eluser] The following config item: Code: $config['index_page'] = "index.php"; ...probably just facilitates calls to base_url() and anchor() etc.. Because mod_rewrite is rewriting URLs internally, the config change shouldn't be a factor in getting 404 errors. Are you absolutely certain you have mod rewrite enabled on your local machine? You can check with phpinfo(). Remove index.php without setting $config['index_page'] to empty string [SOLVED] - El Forum - 08-04-2010 [eluser]cseguin[/eluser] Hello again bretticus, I have checked the mod_rewrite as you said. Not sure if is enable, what I'm sure is that is loaded. After going through all the info phpInfo() returns I've found: In Configuration - apache2handler -> Loaded Modules -> mod_rewrite In my httpd.conf (apache 2.0): Code: LoadModule rewrite_module libexec/apache2/mod_rewrite.so is uncommented. So for what I ve read I assume that is enabled. any more ideas? Remove index.php without setting $config['index_page'] to empty string [SOLVED] - El Forum - 08-04-2010 [eluser]bretticus[/eluser] Yep, apache has it loaded. Is your .htaccess file that you posted above in the same folder as index.php? Remove index.php without setting $config['index_page'] to empty string [SOLVED] - El Forum - 08-04-2010 [eluser]bretticus[/eluser] You might try adding a ? to your rewrite: Code: RewriteCond %{REQUEST_URI} ^system.* By default, uri_protocol is set to "auto" in config.php: Code: $config['uri_protocol'] = "AUTO"; So it works differently on different hosts and configurations. :\ Remove index.php without setting $config['index_page'] to empty string [SOLVED] - El Forum - 08-04-2010 [eluser]cseguin[/eluser] yes, both are at root level (i.e. /Library/WebServer/Documents/) together with system Remove index.php without setting $config['index_page'] to empty string [SOLVED] - El Forum - 08-04-2010 [eluser]bretticus[/eluser] [quote author="cseguin" date="1280958815"]yes, both are at root level (i.e. /Library/WebServer/Documents/) together with system[/quote] Both? Remove index.php without setting $config['index_page'] to empty string [SOLVED] - El Forum - 08-04-2010 [eluser]bretticus[/eluser] [quote author="bretticus" date="1280958932"][quote author="cseguin" date="1280958815"]yes, both are at root level (i.e. /Library/WebServer/Documents/) together with system[/quote] Both?[/quote] Sorry, I know you mean both the index.php file and the .htaccess file. Nevermind. Try my last suggestion. |