I'm looking for a tool that manages vanity url's for a single domain running on Apache (or IHS - IBM HTTP Server).

What i mean by vanity URL:

  • www.mycompany.com/ProjectA would redirect to servera.mycompany.com/whatever
  • www.mycompany.com/ProjectB would redirect to serverb.mycompany.com/another/directory
  • www.mycompany.com/FallCampaign would redirect to servera.mycompany.com/whatever/offer.html
  • etc etc

The current solution implemented consists of thousands of manually updated directories with php scripts which redirect the user. This has come a maintenance nightmare. Converting this solution to a solution using manually updated .htaccess file(s) is not an option either*.

Ideally, this tool would:

  • work for an apache / IHS web server
  • provide a web interface for users and administrators
  • allow users to create, delete and update vanity urls
  • allow users to specify case sensitivity, or case insensitivity for each vanity url
  • allow users to specify redirects as HTTP 301 (permanent) or HTTP 302 (temporary) for each vanity url
  • allows users to specify each vanity url as permanent (for products) or temporary with a 'take down' date (for marketing campaigns).
  • provide a work flow users to submit vanity url requests, and for others to approve it
  • (as a possible solution) write out a single, managed .htaccess file, provided that the file is validated by the tool prior to pushing them out to the server so that it does not negatively impact the server.
  • (as a possible solution) write out directories with redirects/.htaccess files, but would also manage creating, updating and deleting these directories.
  • possibly use a database backend, or a xml backend.
  • provide a solution that meets these critera in a manner i didn't think of.
  • (optional) provide very simple reports (number of permanent urls, number of temporary urls, upcoming temporary URLS's that are expiring, etc)

* using a single manually edited .htaccess file poses too much of a risk if an error is put into the file, could effect all urls. Multiple .htaccess files, located in directories is the same maintenance nightmare as using php redirects.

  • really? no takers?
    – Roy Rico
    Sep 11, 2009 at 16:58
  • but I did vote you up, and favorited - to see if anyone can prove me wrong :)
    – warren
    Sep 13, 2009 at 2:56

2 Answers 2


I don't know what exactly defines a "maintenance nightmare" in your book, but you could try to go with a dynamic rewriting map in apache:

RewriteEngine on
RewriteMap    vanity-map       prg:/path/to/vanity.pl
RewriteRule   ^/(.*)/(.*)$  /${vanity-map:$1}/$2

vanity.pl could could be a simple perl script (don't forget to set $| = 1;) which gets the first part of the request URL (as outlined above) on STDIN and is supposed to rewrite that - e.g. by querying a database.

Now, that just leaves the frontend. I'm an inexperienced Ruby on Rails programmer (it's just a spare time activity), but I think, if it doesn't need to look pretty, even I could write an application that authenticates a user, lets him create a rewriting and shows that up for approval to some IT guys/$WHATEVER in much less than a week, so I don't think any real programmer would have a problem doing that in a few hours. Depending on the database, there might even be frontends readily available which will do the job with only a little customization (php*admin comes to my mind).

This way, you get all the flexibility of a database approach paired with a central source for all redirections. As long as the database's index on the URL part fits in your servers memory, you won't even have to worry about performance.

  • This isn't exactly an out of the box solution that I can just take to management and implement overnight. Although, this looks like a really good solution if I had the time/approval to build it.
    – Roy Rico
    Sep 15, 2009 at 19:07

I've only ever seen this done in the reverse. For example, webmail.domain.tld redirecting to domain.tld/squirrel.

I don't think you can do what you describe via DNS: once you move past the domain into the path, you've left the realm of what DNS handles.

You're sorta describing a URL shortener, like TinyURL. But that would involve the same maintenance headaches you've already described.

  • I'm not sure how I may have confused you, but i'm not looking to do anything with DNS, i'm looking for a tool that easily manages thousands of URLs and redirecting them... Apache already does this, but the implementation is done manually, making managing thousands of redirects a big issue.
    – Roy Rico
    Sep 13, 2009 at 5:11
  • by calling it a 'service', I thought you were going for a DNS-level approach; so, does that mean you are looking for a tr.im-like service but that you can run internally?
    – warren
    Sep 13, 2009 at 5:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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