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 toservera.mycompany.com/whatever
www.mycompany.com/ProjectB
would redirect toserverb.mycompany.com/another/directory
www.mycompany.com/FallCampaign
would redirect toservera.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.
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:
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) onSTDIN
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.
I've only ever seen this done in the reverse. For example,
webmail.domain.tld
redirecting todomain.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.