I lately published an issue about producing vanity Web addresses on my small site even though I acquired many great solutions, I'm curious to determine that which was wrong with my original idea:
This is actually the problem: I presently have ugly Web addresses that appear to be such as this: http://www.hikingsanfrancisco.com/hiker_community/hiker_public_profile.php?community_member_id=2
Things I want is one thing elegant such as this: http://www.hikingsanfrancisco.com/alex-genadinik
What my suggested option would be: Can One just store "alex-genadinik" within the database (rather than MVC remotes) and fetch the vanity URL when lookup the individual. After which I possibly could redirect towards the elegant-searching domain?
Or will the redirection add an amount of technical-clumsiness and inflexibility? Maybe I would not need to redirect whatsoever. I am talking about I'd be searching some misconception within the db rather than the server. I believe thats the only real difference. Ideas? :)
Drupal really does such like, all URL aliases are saved within the database. It can be done nevertheless, you want! I'd consider the various kinds of "factor" you'll have Web addresses for and just how to differentiate them, how you will perform the research whenever a user demands a URL, the way you is going to do the inverse research to create links from organizations, and just how to deal with parameters (i.e. /vanity-url?sortby=blah) for a moment ever need them.
There is nothing wrong together with your suggested solution. Actually WordPress could be set up to complete exactly this.
I'd implement it the following (much like WordPress):
- Come with an .htaccess file catch all non-existant files which are asked for, and rewrite for your router.php
- Have your router.php look into the with this non-existant path inside your db, against a listing of pre-calculated vanity names.
- Whether it is available, display the relevant information, otherwise return some 404 headers to exhibit that neither the file or even the vanity title exist.