How to customize URLs of article, category, photo pages

From TomatoCMS Documentation

Jump to: navigation, search

With 2.0.2 version, developer can customize URLs of article, category, photo pages. This is better for SEO.

In following figure, I configured article page's URL to format of /news/article/view/ID_Of_Category/ID_Of_Article-Slug_Of_Article.html

File:Customize_url.png

Developers have to configure it in route files manually. In the future, we should provide a back-end interface for it.
Now, the back-end interface is not available yet. You have to configure it in route files.
Technically, all route files are stored on the server in the following structure:

    TomatoCMS_Directory
    |
    |___app
           |
           |___modules
                  |
                  |___NameOfModule
                         |
                         |___config
                                |
                                |___routers
                                       |
                                       |___NameOfRouteFile.ini


Example, customize URLs for your articles, go to app/modules/news/config/routers/news.ini and correct 44-51 lines:
[Before]

    routes.news_article_details.type = Zend_Controller_Router_Route_Regex
    routes.news_article_details.route = "news/article/view/(\d+)/(\d+)"
    routes.news_article_details.reverse = "news/article/view/%d/%d"
    routes.news_article_details.defaults.module = "news"
    routes.news_article_details.defaults.controller = "Article"
    routes.news_article_details.defaults.action = "details"
    routes.news_article_details.map.1 = category_id
    routes.news_article_details.map.2 = article_id


[After]

    routes.news_article_details.type = Zend_Controller_Router_Route_Regex
    routes.news_article_details.route = "news/article/view/(\d+)/(\d+)-([\w-_]+).html"
    routes.news_article_details.reverse = "news/article/view/%d/%d-%s.html"
    routes.news_article_details.defaults.module = "news"
    routes.news_article_details.defaults.controller = "Article"
    routes.news_article_details.defaults.action = "details"
    routes.news_article_details.map.1 = category_id
    routes.news_article_details.map.2 = article_id
    routes.news_article_details.map.3 = slug

I hope this help you! The process of essay writing will be much easier with MarvelousEssays.Com as there are a lot of highly professional and talented writers who are always eager to help you out with any sort of academic assignments regardless of the complexity levels. I do know what I�m talking about!

Personal tools