2

I have always used mod_rewrite for creating clean looking URLs, until recently I didn’t know there was any other option. A few weeks back someone on here pointed out that exactly the same effect can be achieved using apache PATH_INFO. Thinking about it now, I assume this is what most PHP frameworks do, optionally relying on mod_rewrite purely to remove the index.php bootstrap from the URL.

All leads to a few questions:

  1. Which is the better way of creating a clean and flexible URL structure like: /page/var/foo/bar/2?
  2. What are the relative advantages/disadvantages of the two methods?
  3. Which method peforms better in terms of resource usage etc.?

Thanks.

Gumbo
  • 643,351
  • 109
  • 780
  • 844
robjmills
  • 18,438
  • 15
  • 77
  • 121

1 Answers1

0

with pathinfo you will always have script name in the url, which looks pretty lame (and not considered valid by some agents). I'd suggest mod_rewrite as primary method with pathinfo or 404 handler as fallbacks.

user187291
  • 53,363
  • 19
  • 95
  • 127
  • 1
    pretty sure i've seen path_info examples without script name in URL, can anyone confirm? – robjmills Oct 14 '09 at 12:53
  • 2
    I'd say it's not possible, but I've been wrong before. However, using `mod_rewrite` to simply redirect all requests to a script and using `path_info` in that script is very possible and to my understanding very common. – nikc.org Oct 14 '09 at 14:32