简体   繁体   中英

tt_news and RealURL: shorten URL of news article

Currently the URL for a news article looks like

www.domain.com/path/to/page/news/news-detail/article/articlename

Is there a way to shorten this URL? Eg missing out article or news-detail?

In the RealUrl-Configuration there is the array article but I don't know if I can change this for example to news-detail ...

Do you have some ideas?

I'm using Typo3 4.5.5, realurl 1.11.2 and tt_news 3.0.1.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM