Monday, September 3, 2012

My answer to "Remove the viewquestion"

This is my answer to a Question on Support site for LampCMS project


Yes, it's quite simple. It required to define an alias for the controller name.
Look in [ROUTES] section of !config.ini
Basically there are already some aliases being used in default installation. The /tags/ url is actually an alias for the /viewtags/ controller.
You can define your own alias for viewquestions in the same way, for example
add:
topic = viewquestion

Then the url will be /topic/12/SomeQuestion

The nice thing about it is that you modify alias for routes even after you already have lots of questions on your site.
So if someone bookmarked your link to /viewquestion/quest123/How_are_you
Then you add alias
topic = viewquestion

and then when someone follows the old link the system will use 304 redirect to point to the new url:
/topic/quest123/How_are_you


No comments:

Post a Comment