1

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? E.g. 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.

testing
  • 19,681
  • 50
  • 236
  • 417

2 Answers2

3

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)
konsolenfreddy
  • 9,551
  • 1
  • 25
  • 36
  • I have your code from `fixedPostVars` in my `postVarSets` in the array "article". Do I have to change this? I think I only have to move my detail news page up in the root as you wrote. If I have the list and detail view on the same page, than I would see the news overview and the news itself. Don't know if this is desired, but thanks for your suggestion. – testing Mar 09 '12 at 10:59
  • What do you think of [this configuration I found](http://www.fsmedia.at/blog/artikel/wirklich-schoene-urls-mit-tt-news-und-realurl.html)? – testing Mar 09 '12 at 11:13
  • ad1) Yes, you would have to move it from `postVarSets` to `fixedPostVars` (the syntax in both of them differs slightly). ad2) The pointer in the example config is not needed IMHO. – konsolenfreddy Mar 09 '12 at 12:10
1

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
Fedir RYKHTIK
  • 9,844
  • 6
  • 58
  • 68
  • The first solution seems interesting! Does it mean that I only would have to move the page on a higher level of the page tree and change the page in the news setting accordingly? – testing Mar 08 '12 at 15:56
  • Yes, You could reorganize Your tree to adapt the system to Your SEO strategy. As I remember, You could also hide the page in the URL, there is such option in the page properties. – Fedir RYKHTIK Mar 08 '12 at 17:22
  • Do you mean the option `Override the whole page path`? This is in combination with `Speaking URL path segement`. – testing Mar 09 '12 at 10:50
  • "Exclude from speaking URL", when You are hiding current page segment in the URL path. – Fedir RYKHTIK Mar 09 '12 at 10:54