.htaccess custom URL's - 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: .htaccess custom URL's (/showthread.php?tid=43295) |
.htaccess custom URL's - El Forum - 07-06-2011 [eluser]alphabase[/eluser] Hi, I am using CI with the Facebook SDK, and have decided to drop the index.php in my URL. Now I'm trying to make custom URL's, for instance for the About-page. Like this: http://dev1.example.com/about rewrites to http://dev1.example.com/index.php/page/load/about Here's my current .htaccess: Code: RewriteEngine on Could someone explain to me how to manage this? EDIT: Code: $config['index_page'] = ''; .htaccess custom URL's - El Forum - 07-06-2011 [eluser]alphabase[/eluser] Great, I solved it myself, sorry to bother the forum with this... Here's my .htaccess: Code: <IfModule mod_rewrite.c> Here's my config: Code: $config['index_page'] = ''; The problem was in the uri_protocol, which I changed from AUTO to QUERY_STRING. Problem is resolved. .htaccess custom URL's - El Forum - 07-06-2011 [eluser]toopay[/eluser] Actually you can still manage your application to remove the index.php from your uri. In some environment you need to set your uri_protocol to PATH_INFO, and in your htaccess remove '?' after index.php in the rewrite rule(you may net to tweak the regex rules too for that). .htaccess custom URL's - El Forum - 07-06-2011 [eluser]alphabase[/eluser] I'm sorry to note that I don't understand what the (...) you're talking about, but I guess for others it might sound logical. I've had some trouble with implementing the Facebook API (now using query_strings so that the SDK can grab the codes returned by Facebook via GET), and at the moment everything still works. To conclude, my problem is resolved. .htaccess custom URL's - El Forum - 07-06-2011 [eluser]Mirge[/eluser] [quote author="alphabase" date="1310012627"]I'm sorry to note that I don't understand what the (...) you're talking about,[/quote] :lol: rofl .htaccess custom URL's - El Forum - 07-06-2011 [eluser]toopay[/eluser] [quote author="alphabase" date="1310012627"]I've had some trouble with implementing the Facebook API (now using query_strings so that the SDK can grab the codes returned by Facebook via GET)[/quote] I just actually let you know, why your previous code not works. I see you use '?' in your htaccess, and thats could tell php that no input being specified while you try to retrieve $_GET param. Because, in your previous htaccess, http://yoursite.com/somecontroller?code=foo is actually http://yoursite.com/index.php?somecontroller?code=foo. But, if you already happy with your solution, that additional information still might usefull for your future reference. .htaccess custom URL's - El Forum - 07-08-2011 [eluser]alphabase[/eluser] [quote author="toopay" date="1310015676"]I just actually let you know, why your previous code not works. I see you use '?' in your htaccess, and thats could tell php that no input being specified while you try to retrieve $_GET param. Because, in your previous htaccess, http://yoursite.com/somecontroller?code=foo is actually http://yoursite.com/index.php?somecontroller?code=foo.[/quote] Allright, I'm listening, I guess it's starting to make sense to me now. I understand that I should change my .htaccess to the following: Code: <IfModule mod_rewrite.c> And then I should change the following lines in my config.php: Code: $config['index_page'] = ''; I've tested that, but when I do, the page always returns to the homepage, no matter what. Got suggestions? .htaccess custom URL's - El Forum - 07-09-2011 [eluser]toopay[/eluser] Whats happening if you ONLY put these htaccess Code: RewriteEngine on Code: # try these combination to replace last line in above htaccess |