Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

See this NYTimes url:

If we type

in browser, it automatically redirects us to the above article, the only article in that folder starting with "war-i".

How to do this in a site with apache, which serves static html files only? That is, if there is a apache module, without adding scripts, that would be best.

share|improve this question

The behavior you're talking about is actually implemented by the script itself, not Apache. That is, note the following site on the official WordPress blog site, which does the same thing (this is just a random blog I found on the front page):

The same URL can be accessed by going to any combination of the following:

This "pretty URL" is actually enforced by mod_rewrite rules, which rewrites the URL to something that the script can understand, i.e.:

RewriteRule ^([12][0-9]{3})/([0-9]{2})/([0-9]{2})/(.*)$ /somescript.php?year=$1&month=$2&day=$3&title=$4

And so on. The script receives the post title, realizes there's nothing by that name, and searches for titles in the database to see if it can find a match. If it does, it redirects.

I really hope this clarifies what you're looking for!


share|improve this answer

The sites that do that do it through their scripting, not the webserver.

If you absolutely have to do it on static HTML, mod_speling can almost do this. Someone dedicated or crazy enough could probably get it to work in a day or so.

share|improve this answer

You can probably get a working implementation together in a few minutes if you're good at writing shell scripts or perl.

mod_rewrite + RewriteMap/MapType: prg + filename completion script

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.