tags:

views:

47

answers:

1

Hey everybody,

Probably someone has already asked this question but I'm not sure what I'm looking for. I've seen a couple of applications in PHP that are doing this kind of url rewriting "http://site.com/index.php/myaction/avariable"
I've done a similar thing with mod_rewrite where you'd have almost the same link "http://site.com/whateveryouwant/myaction/avariable" that would redirect to the original page - http://site.com/index.php?action=myaction&variable=avariable (just an example)

What exactly is the difference ? I suspect that the first thing is done via PHP but I'm not sure how.

An example of what I'm talking about could also be the framework Symfony 2.0.

Any suggestions would be welcome.

Sorry if this is a duplicating question... I just don't know what I'm looking for. :|

Thanks in advance, Me

+3  A: 

The general term is "routing". You can also find info under "pretty urls" and "seo friendly urls". The latter two will most likely get a mix results with what youre looking for, as well as what youve been doing with mod_rewrite already. But routing should turn up integrating some basic rewriting to direct to a Front Controller, and then use some scripting to parse the url and dispatch the request to the application.

I think youll find the clearest example if you look at the documentation for the Zend_Framework architecture - in particular the Zend_Controller_Router component. Or you could also look through the Routing classes in Symfony 2.0 or 1.4... or any other framework really. I only mention Zend because they get into some detail about how it actually works internally - not just using it within the context of an app.

prodigitalson
Thank you very much. That was exactly what I was looking for. I'm sorry I can't vote for your answer but when I get the needed points I'll do :)
The Devil
Welcome to SO. :-)
prodigitalson