Translations
Info
All page names need to be in English.
en da  de  fr  it  ja  km  nl  ru  zh

RealURL

From TYPO3Wiki
Jump to: navigation, search
Extension detail information
realurl (extension)/ realurl (extension)
Creates nice looking URLs for TYPO3 web pages. Public free support is provided only through TYPO3 mailing lists. Contact by e-mail for commercial support.
documentation state [[:Category:|]] [[Category:]] document state list
licence OCL
forgeproject
mailinglist
usergroups list of usergroups
author(s) Martin Poelstra, Kasper Skaarhoj, Dmitry Dulepov
TER category
dependency

<< Back to Extension manuals page

[edit]


More pages about RealURL

Informational articles

For extension developers

To create links compatible with RealURL, use the typolink() function.

Here are some articles that will show you how:

Glossary definitions

glossary-definition: RealURL: automatic transformation of URLs with query string to readable URLs (a virtual path, also called Speaking URL) in the frontend, for example index.php?id=123&type=0&L=1 into dutch/contact/company-info/page.html and vice-versa.

The extension is very flexible and its abilities range from translation of simple page IDs to almost any possible combination of GET parameters.

Preserving a history of URLs

When you rename or move a page, its speaking URL will be modified accordingly. However for the sake of preserving inbound links or bookmarks, it is desirable to also keep the old URLs. For this to work, use this setting:

PHP script:
$TYPO3_CONF_VARS['EXTCONF']['realurl']['_DEFAULT']['pagePath']['expireDays'] = 180; // Number of days

WARNING: You have to make sure that the tx_realurl_pathdata table is not emptied when the FE cache is cleared. If it was, old entries, which should still be kept because their expiry time has not yet passed, would be lost.

How does this work?

Many things are going on inside RealURL when it generates a new speaking URL. In particular the resulting URL is stored in the tx_realurl_pathdata table. When the path to a page is modified, this table is updated. By default, RealURL tries to keep one speaking URL per page. When expireDays is set, the old URL is preserved when the new URL is stored. Whenever the old URL is used later, RealURL redirects from the old URL to the new one, sending a 301 header along to indicate that the page has permanently moved. This preserves the pages history in search engines.

Limitations

There are a couple of issues:

  • "expireDays" is supposed to define a time after which old URLs will be cleaned up in order to avoid cluttering the pathdata table. Although the expiration delay is indeed set, RealURL does not seem to contain any cleanup mechanism. So old URLs will be preserved indefinitely no matter what value you set for "expireDays". Thus you may want to perform some manual cleanup yourself after a while, for example by using the speaking URL management module in the backend.
  • Some pages can display varying information. For example a page with the tt_news plug-in will display a different news item depending on the news id number passed to the page. For each of these news items RealURL will generate a specific speaking URL (if properly configured, of course). These URLs are stored in the tx_realurl_uniqalias table. These aliases are not updated when, for example, the title of a news item is changed; nor does the expiry delay get set.

FAQ

I get URLs with numbers instead of names (http://www.mydomain.tld/123/345/)

The domain is not set up correctly in the RealURL configuration. Especially, the "rootpage_id" is not set.

This example can be used in a multi-domain environment and a default RealURL configuration:

PHP script:
 // Define root page id for each domain
 $rootPids = array(
     'www.domain1.tld' => 119,
     'domain1.tld' => 119,
     'www.domain2.tld' => 158, 
     'domain2.tld' => 158, 
 ); 
 
 $TYPO3_CONF_VARS['EXTCONF']['realurl']['_DEFAULT'] = array(
     // ...
 
     'pagePath' => array(
         'spaceCharacter' => '-',
         'expireDays' => 0,
         'rootpage_id' => $rootPids[$_SERVER['HTTP_HOST']],
     ), 
 );

Error: Reason: "some/url/" could not be found, closest page matching is

Reason: RealURL couldn't detect your root page id Solution: If you use automatic configuration, add this to LocalConfiguration.php:

PHP script:
$TYPO3_CONF_VARS['EXTCONF']['realurl']['_DEFAULT']['pagePath']['rootpage_id'] = '<uid of your root page eg. 1>';

With manual configuration, just set rootpage_id inside the pagePath array.