Yet another "index.php" problem |
[eluser]Lionel H[/eluser]
Hello everybody, I'm a french autodidact PHP developper ; I've just discovered CI and I really love it ! I have a "index.php" problem ; a sample of code is much clear than a long explanation : "home" controller (set as the default controller in config/routes.php) : Code: class Home extends Controller { "home_view" : Code: <html> "blog" controller : Code: class Blog extends Controller { http://myserver/ci/index.php/home/index.php/blog/insert and, of course, a 404 error. Can I resolve this problem by removing the "index.php" ? I've read The User Guide and The Wiki about removing the index.php, and many posts in forum too, but I'm not able at all to remove this "index.php" (I've tried many .htaccess configurations, on my local server on my Mac and on distant pro servers). I'm sorry if this question has been already asked, but I've spent all the day to search the solution for nothing... Thanks in advance ! :-)
[eluser]foutrelis[/eluser]
Hello Lionel, I had the same issue yesterday and I think the solution is to set the base url inside application/config/config.php ($config['base_url']). I hope this helps
[eluser]Lionel H[/eluser]
Thank you Foutrelis, it works ! :-) At the same time, I've just discovered the step 3 here. I promise I'll RTFM. I promise I'll RTFM. I promise... ;-) I'll try to get rid of the "index.php" in the address bar later, I have to keep on re-writing my website with CI...
[eluser]foutrelis[/eluser]
You're welcome :-P btw, I use this .htaccess to get rid of index.php (based on CI docs): Code: <IfModule mod_rewrite.c>
[eluser]Lionel H[/eluser]
Well, removing the index.php doesn't seem to work with all servers ; Free (a big french ISP) doesn't allow many arguments in the .htaccess file, and I get a 500 error for each .htaccess I've tried. So I leave this index.php for the moment ! ;-)
[eluser]Carlton[/eluser]
Hi Lionel H, I was following the instructions but still had problems with .htaccess Is your server set up like http://localhost/CI/ ?? I think the instructions assume you are simply at http://localhost....try adding your directory name before the index.php...e.g. mine is CI Code: RewriteEngine on
[eluser]Lionel H[/eluser]
Hello Cariton, well, I haven't tried to do without the index.php since I posted here, because I had to finish a website. I'm really sorry, I still don't know how to do that...
[eluser]alexsancho[/eluser]
@Carlton: you can try this instad Code: RewriteEngine on
[eluser]Carlton[/eluser]
Thanks Alex, I thought that's what that directive might be for. Also if you call your css/images/javascript folders something other than css|images|jscript be sure to add them to the RewirteCond directive
[eluser]alexsancho[/eluser]
To avoid this things I've normally use a slightly diferent directives Code: RewriteEngine On In plain english what i'm doing is redirecting all that doesn't really exists on server path to index.php |
Welcome Guest, Not a member yet? Register Sign In |