tt_news and RealURL: shorten URL of news article

自古美人都是妖i 提交于 2019-12-08 05:36:17

If you want to exclude the keywords indicating a new part of the rewritten url, use fixedPostVars:

'fixedPostVars' => array(
    '123' =>array(
        array(
            'GETvar' => 'tx_ttnews[tt_news]',
            'lookUpTable' => array(
                'table' => 'tt_news',
                'id_field' => 'uid',
                'alias_field' => 'title',
                'addWhereClause' => ' AND NOT deleted',
                'useUniqueCache' => 1,
                'useUniqueCache_conf' => array(
                    'strtolower' => 1,
                    'spaceCharacter' => '-',
                ),
            ),
        ),
    ),
),

This will create a url like domain.com/article/your-article-title, presuming you have the following site structure:

root
 |- news (pid xy)
 |- article (pid 123)

You can also have the list and detail view on the same page which would make even cleaner urls (domain.com/news/your-article-title):

root
 |- news (pid 123, configured for list and detail)

One way is to exclude some pages to be shown in the URL path ?

www.domain.com/news-detail/article/articlename

You could also use another key as identifier (for example, Id instead of the news title). It will be less human-readable, but much shorten.

www.domain.com/news-detail/article/articleid
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!