CodeIgniter Forums
Rewriting arguments in htaccess - 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: Rewriting arguments in htaccess (/showthread.php?tid=32644)



Rewriting arguments in htaccess - El Forum - 07-29-2010

[eluser]Unknown[/eluser]
Hi all,

I succesfully managed to remove index.php, and my next challenge are arguments in a PHP url.

This is what happens now:

about.php is rewritten to home/about using htaccess rewrite rules.

What I want now is the following:

about.php?herp to home/about/herp

I know that a simple Rewrile rule wont do it since the arguments are not passed. I heard something about rewriteCond but I dont see how this is applied exactly...

Thanks a bunch


Rewriting arguments in htaccess - El Forum - 07-29-2010

[eluser]WanWizard[/eluser]
CI doesn't use the query string in the default setup, you have to pass arguments to your controller method via URI segments:
http://www.example.org/controller/methods/arg1/arg2 or http://www.example.org/controller/methods/var1/value1/var2/value2

See the section on the URI class in the user guide.


Rewriting arguments in htaccess - El Forum - 07-29-2010

[eluser]Unknown[/eluser]
I know that, that is exactly why I am trying to rewrite urls with ?arg arguments to the /args equivalent in codeigniter using apache rules


Rewriting arguments in htaccess - El Forum - 07-29-2010

[eluser]haydenk[/eluser]
I would check out URI Routing as well if not instead of the URI Class.

It'll allow you more control on what and where you pass URL variables.