The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

php url variables vs directories

Wordpress is using directories instead of url variables.
Ex: "" instead of

What is the advantage of using directories over page variables? And how do I do this myself? What should I google for?
Saturday, March 10, 2007
This thread:

discussed this (among other things)

You can do it with real directories, or with mod_rewrite
I understand the advantage is that you have URLs that are more readable.

Hopefully someone will correct me if I'm wrong
Parisian Developer (still looking)
Saturday, March 10, 2007
I think you will find they are not directories, but rather as has been suggested, using some form of URL rewrite - so the [directory] structure is processed and fed to the backend server as [URL page variables].

The original intent, I believe, was due to search engines not indexing pages with (any) too many URL variables, etc.

I think it looks neater aesthetically too, but that's subjective at best.

mod_rewrite is the apache module

isapi_rewrite ( is an example that works with iis.

I recently installed isapi_rewrite on my laptop, and the rule for your example would be something like:

# indicates a commen
# convert /blog/page/2
# to      /blog/index.php?page=2
RewriteRule /blog/page/(.*) /blog/index.php?page=$1 [I,L]

Aaron DC Send private email
Sunday, March 11, 2007
Is one method better than the other? more secure or something?
Sunday, March 11, 2007
I already answered your question, try reading my response again.

How long have you been a web_dev?

Aaron DC Send private email
Monday, March 12, 2007
Aaron DC,

I don't think that one is subjective at all... both of these links go to the same post, which is more meaningful to you? OR
KC Send private email
Monday, March 12, 2007
> The original intent, I believe, was due to search engines
> not indexing pages with (any) too many URL variables, etc.


Yes you have answered. I apologize. I was too concerned with security issues, so I must have looked right past your answer.

I haven't been a web developer for long. Too obvious? But I am learning as fast as I can.
Monday, March 12, 2007
Three words ... Search Engine Optimization.
The text in the urls seems to have a good about of weight with the search engines.
Monday, March 12, 2007
You could just write a simple 404 handler that parses what's in the URI. Split on the / and you can pull the "2" out in your example URL to fetch the data if that was an ID or something.
Tim Patterson Send private email
Thursday, March 22, 2007

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz