![]() |
Forcing index.php (WAS: Issues Removing index.php) - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Forcing index.php (WAS: Issues Removing index.php) (/showthread.php?tid=13046) Pages:
1
2
|
Forcing index.php (WAS: Issues Removing index.php) - El Forum - 11-09-2008 [eluser]Jonathan Ledbetter[/eluser] EDIT: Thanks to bastones, I have figured out how to force index.php into my CI install. I still would like to eventually remove it completely, however, so if you have a thought, by all means post. Hello fellow CodeIgniters, Jonathan here, and I've used CodeIgniter for a couple of projects at my job, so I figure that it would make an excellent framework for my personal site. I'm brand-new to the forums. I've successfully removed "index.php" when setting up other CI installs, but I'm having some trouble removing it on my personal site this time. I've been through the forums and the user guide a few times, and even though I think I'm doing it right, for some reason I still cannot remove "index.php" from my URLs. Example: visit here vs. here. My hosting company is HostMonster, if that makes a difference. I don't know much about .htaccess files, but here's mine: Code: # Use PHP5CGI as default One thing I know is that commenting/uncommenting DirectoryIndex makes no difference. My /application/config/config.php file (showing the only things I've changed): Code: $config['base_url'] = "http://www.jandbledbetter.com/"; Also, if it makes any difference, I've moved my /application/ folder out of the /system/ folder so that /application/ and /system/ are on the same level. This index.php thing is my main problem. I get a "No input file specified" message in other PHP files I have that use query strings, but that's because I need to convert those files to using CI's format, not a big deal. Any help would be much appreciated. Forcing index.php (WAS: Issues Removing index.php) - El Forum - 11-09-2008 [eluser]BaRzO[/eluser] Code: /* do you have in .htaccess RewriteBase / ? Forcing index.php (WAS: Issues Removing index.php) - El Forum - 11-09-2008 [eluser]Jonathan Ledbetter[/eluser] BaRzO, thank you for the suggestions, but unfortunately, neither changing 'REQUEST_URI' to 'AUTO' or adding RewriteBase / to my .htaccess did the trick. :down: My .htaccess now looks like this (after changing to a different RewriteRule configuration): Code: # Use PHP5CGI as default I reverted the uri_protocol back to 'REQUEST_URI', so the .htaccess file is the only one changed thus far. Any other suggestions? Forcing index.php (WAS: Issues Removing index.php) - El Forum - 11-09-2008 [eluser]bastones[/eluser] Yeah, I had a similar problem with htaccess and index.php, I simply set URI_PROTOCOL to REQUEST_URI and added the following htaccess and it all worked: Code: RewriteEngine on Try the preceding line of code with and without REQUEST_URI, and see if it works. Sorry if you have already done this but it did fix my problem ![]() ![]() Forcing index.php (WAS: Issues Removing index.php) - El Forum - 11-09-2008 [eluser]Jonathan Ledbetter[/eluser] Thanks bastones, but unfortunately that .htaccess code, both with and without 'REQUEST_URI', did not eliminate index.php from my URLs. But thanks again for the input. I'm beginning to think that it may not be a CI issue, but a HostMonster or a php.ini issue. Does anyone think that may be the cause? Or does anyone have any other ideas? At this point, I'm just considering having a rewrite rule turn www.jandbledbetter.com/controller/method/whatever into www.jandbledbetter.com/index.php/controller/method/whatever just so my site doesn't break. Any help with that would also be much appreciated. I'm going to bed now, but I look forward to more responses. Thanks again for your help! Forcing index.php (WAS: Issues Removing index.php) - El Forum - 11-09-2008 [eluser]bastones[/eluser] [quote author="Jonathan Ledbetter" date="1226242806"]Thanks bastones, but unfortunately that .htaccess code, both with and without 'REQUEST_URI', did not eliminate index.php from my URLs. But thanks again for the input. I'm beginning to think that it may not be a CI issue, but a HostMonster or a php.ini issue. Does anyone think that may be the cause? Or does anyone have any other ideas? At this point, I'm just considering having a rewrite rule turn www.jandbledbetter.com/controller/method/whatever into www.jandbledbetter.com/index.php/controller/method/whatever just so my site doesn't break. Any help with that would also be much appreciated. I'm going to bed now, but I look forward to more responses. Thanks again for your help![/quote] If the same server your on now has worked before consider replacing all the files except the controller/model/views section, and then do the steps above. If all fails its either to do with your webhost or your controller code most probably. But if this has failed so far it may be a problem with HostMonster so you may want to contact them about it. Forcing index.php (WAS: Issues Removing index.php) - El Forum - 11-09-2008 [eluser]Jonathan Ledbetter[/eluser] Thanks to all who have helped with this problem, but I think I'll contact HostMonster and see if they have any light they can shed on the situation. In the meantime, I'd like to force "index.php" into all my URLs using .htaccess, and I'm not sure how to do it. BEHAVIOR: I'd like to go from this: http://www.jandbledbetter.com/ http://www.jandbledbetter.com/other/index/123/abc to: http://www.jandbledbetter.com/index.php http://www.jandbledbetter.com/index.php/other/index/123/abc However, I would like "index.php" to be added only when it is not present. Therefore: http://www.jandbledbetter.com/index.php http://www.jandbledbetter.com/index.php/other/index/123/abc should not become: http://www.jandbledbetter.com/index.php/index.php http://www.jandbledbetter.com/index.php/index.php/other/index/123/abc Does anyone have any ideas? Like I said, I have no idea what I'm doing with regard to my .htaccess files. I'd be really thankful, and I'd credit you in my colophon when my site finally gets up and running. Thanks in advance! I'll try looking on the forums when I get the chance as well. Forcing index.php (WAS: Issues Removing index.php) - El Forum - 11-09-2008 [eluser]bastones[/eluser] [quote author="Jonathan Ledbetter" date="1226279023"]Thanks to all who have helped with this problem, but I think I'll contact HostMonster and see if they have any light they can shed on the situation. In the meantime, I'd like to force "index.php" into all my URLs using .htaccess, and I'm not sure how to do it. BEHAVIOR: I'd like to go from this: http://www.jandbledbetter.com/ http://www.jandbledbetter.com/other/index/123/abc to: http://www.jandbledbetter.com/index.php http://www.jandbledbetter.com/index.php/other/index/123/abc However, I would like "index.php" to be added only when it is not present. Therefore: http://www.jandbledbetter.com/index.php http://www.jandbledbetter.com/index.php/other/index/123/abc should not become: http://www.jandbledbetter.com/index.php/index.php http://www.jandbledbetter.com/index.php/index.php/other/index/123/abc Does anyone have any ideas? Like I said, I have no idea what I'm doing with regard to my .htaccess files. I'd be really thankful, and I'd credit you in my colophon when my site finally gets up and running. Thanks in advance! I'll try looking on the forums when I get the chance as well.[/quote] You can get index.php back in the meanwhile by going to system/application/config/config.php and changing the $config['index_page'] variable to: Code: $config['index_page'] = "index.php"; if it isn't that already. If it is, make sure you remove everything from the htaccess file as well. To get your site URL without the index.php use the base_url() function as part of the URL helpers: Code: <?php To get your site URL with the index.php (while you have no htaccess, etc) use site_url(), but it can easily be used with htaccess as it will only add the index.php to the end if it is specified in the $config['index_page'] config variable. Remember to remove the index_page config (by making it blank - ""), when adding htaccess. ?>[/code] Forcing index.php (WAS: Issues Removing index.php) - El Forum - 11-09-2008 [eluser]Jonathan Ledbetter[/eluser] bastones, Thanks for your suggestions, they seem to be doing the trick for at least a temporary solution to my .htaccess problems. What I ended up doing was removing my Rewrite conditions in my .htaccess file, keeping my DirectoryIndex index.php configuration, and changing my $config['index_page'] to "index.php". That allowed both http://www.jandbledbetter.com/ and http://www.jandbledbetter.com/index.php to resolve to the same controller. This may end up being a livable solution for me, but if anyone else has any suggestions about the Rewrite conditions and eventually eliminating "index.php", I'm still subscribed to this thread, and I'll try it out and reply. Thanks again bastones. Forcing index.php (WAS: Issues Removing index.php) - El Forum - 11-09-2008 [eluser]bastones[/eluser] [quote author="Jonathan Ledbetter" date="1226296493"]bastones, Thanks for your suggestions, they seem to be doing the trick for at least a temporary solution to my .htaccess problems. What I ended up doing was removing my Rewrite conditions in my .htaccess file, keeping my DirectoryIndex index.php configuration, and changing my $config['index_page'] to "index.php". That allowed both http://www.jandbledbetter.com/ and http://www.jandbledbetter.com/index.php to resolve to the same controller. This may end up being a livable solution for me, but if anyone else has any suggestions about the Rewrite conditions and eventually eliminating "index.php", I'm still subscribed to this thread, and I'll try it out and reply. Thanks again bastones.[/quote] Hi, I have one more solution if it hasn't already been mentioned or done. You see in the config.php file (config/config.php), the following lines: Code: /* I had to change the value of that variable array to ORIG_PATH_INFO for my .htaccess to work; so you can try any of the values stated in the PHP comment see if that works :). Hope this helps ![]() |