Mod_rewrite or path_info for clean urls
I've always used mod_rewrite to generate clean urls, until recently I didn't know there was another option. A few weeks ago, someone here pointed out that the exact same effect can be achieved with apache PATH_INFO
. Thinking about it now, I am assuming that this is what most PHP frameworks do, not necessarily relying on mod_rewrite to simply remove the loading bin index.php
from the url.
This all leads to several questions:
- What is the best way to create a clean and flexible url structure like
/page/var/foo/bar/2
:? - What are the relative advantages / disadvantages of the two methods?
- Which method displays better in terms of resource usage, etc.?
Thank.
+2
robjmills
source
to share
1 answer
with pathinfo you will always have the script name in the url, which looks pretty lame (and not considered valid for some agents). I suggest mod_rewrite as main method with pathinfo or 404 handler as backups.
0
user187291
source
to share