RealURL
<< Back to Extension manuals page
see more wikpages about the topic RealURL.
Contents |
Information pointers
- Examples:
- Articles from the author:
- Wiki pages:
For extension developers
To create links compatible with RealURL, use typolink() function.
Here is some articles that will show you how:
- Using links in frontend plugins by Robert Lemke
- Linking properly in your TYPO3 code by Dmitry Dulepov
See also wiki-pages about extension development
Glossary definitions
glossary-definition: RealURL: automatic transformation of URLs with GET parameter in the frontend (like index.php?id=123&type=0&L=1) into a virtual path, a so called Speaking URL (like dutch/contact/company-info/page.html) and back again. The objective is that URLs shall be as human readable as possible.
The extension is very flexible and can provide from simple translation of page IDs to encoding of almost any possible combination of GET parameters.
for utf8 workaround, not approved yet by the author
workaround for UTF-8
A problem occurs with databases in UTF-8 and the bk_realurl02 key. The problem is described here:
The problem still occurs when: [multiplyDBfieldSize] > 1
The install tool recommends:
Double: 1-5: Amount used to multiply the DB field size when the install tool is evaluating the database size (eg. "2.5"). This is useful if you want to expand the size of fields for utf-8 etc. For western european sites using utf-8 the need should not be for more than twice the normal single-byte size (2) and for chinese / asian languages 3 should suffice.
So I set it to 2!
This means the key length will be (using the default realurl table setup):
(tablename,field_alias,field_id,value_alias(220),expire); 3*(100+60+60+220) + 11 = 1331
This gives us a maximum of 110 chars to be used from the value_alias
((1000 - 11) / 3) - 100 - 60 - 60 = 110
So, Chinese and Asian users using UTF-8 would get a key length of:
3*(150+90+90+220) + 11 = 1661
This gives chinese and asian users 0 chars to be used from the value_alias
((1000 - 11) / 3) - 150 - 90 - 90 = 0
This would mean that Chinese and Asian users will not be able to use the value_alias in the key at all!
A fix for european users who have set the multiplyDBfieldSize to 2 is:CREATE TABLE tx_realurl_uniqalias( uid INT( 11 ) NOT NULL AUTO_INCREMENT , tstamp INT( 11 ) DEFAULT '0' NOT NULL , tablename VARCHAR( 50 ) DEFAULT '' NOT NULL , field_alias VARCHAR( 30 ) DEFAULT '' NOT NULL , field_id VARCHAR( 30 ) DEFAULT '' NOT NULL , value_alias VARCHAR( 255 ) DEFAULT '' NOT NULL , value_id INT( 11 ) DEFAULT '0' NOT NULL , lang INT( 11 ) DEFAULT '0' NOT NULL , expire INT( 11 ) DEFAULT '0' NOT NULL , PRIMARY KEY ( uid ) , KEY tablename( tablename ) , KEY bk_realurl01( field_alias, field_id, value_id, lang, expire ) , KEY bk_realurl02( tablename, field_alias, field_id, value_alias( 110 ) , expire ) )
Preserving a history of URLs
(Francois 11:26, 18 February 2008 (CET))
When you rename or move a page, it's speaking URL will be modified accordingly. However for the sake of good referencing or bookmarks that people may have defined it is more often than not desirable to keep the old speaking URLs. This can be achieved with RealURL by simply setting:
$TYPO3_CONF_VARS['EXTCONF']['realurl']['_DEFAULT']['pagePath']['autoUpdatePathCache'] = true;
Obviously if you want your old URLs to be preserved you have to make sure that the pathcache table is not emptied when the FE cache is cleared, i.e. you must make sure you don't have something like
$TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearAllCache_additionalTables']['tx_realurl_pathcache'] = 'tx_realurl_pathcache';
in your setup. You can check it out using the Tools > Configuration module.
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 "pathcache" table (tx_realurl_pathcache). When the path to a page is somehow modified, either because it moved or renamed, the pathcache is updated. By default RealURL tries to keep a single speaking URL per page. When setting "autoUpdatePathCache" as above this process is modified. The new speaking URL is stored in the pathcache table as expected, but the old one is preserved. Whenever it is used at a later stage, RealURL performs a redirection from the old speaking URL to the new one, sending a 301 header along to indicate that the page has permanently moved. This is very good for search engines because it tells them to update their registry of referenced pages without loosing any ranking or relevance information they may have had already calculated.
Limitations
There are a couple of bugs or issues that must be known:
- the RealURL manual mentions a setting called "expireDays" to use in conjunction with "autoUpdatePathCache". It is supposed to define a time after which old URLs will be cleaned up in order to avoid cluttering to pathcache 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 found in Web > Info.
- 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 store in the "unique alias" table (tx_realurl_uniqalias). These aliases are not updated when, for example, the title of a news item is changed. Nor is the expiry delay set.
FAQ
I get URL's with numbers instead of names (http://www.mydomain.tld/123/345/)
You don't have the domain added in the realurl configuration. Make sure that you have a configuration for all domains in use (e.g. www.mydomain.tld, mydomain.tld, test.mydomain.tld).
This example can be used in a multi domain environment and a default realurl configuration:
// Root-PID definieren for each Domain!
$RootPID = array(
'www.domain1.tld' => '119',
'domain1.tld' => '119',
'www.domain2.tld' => '158',
'domain2.tld' => '158',
// more domains ...
);
$TYPO3_CONF_VARS['EXTCONF']['realurl']['_DEFAULT'] = array(
'init' => array(
// [snip]
),
'pagePath' => array(
'type' => 'user',
'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
'spaceCharacter' => '-',
'languageGetVar' => 'L',
'expireDays' => 0,
'rootpage_id' => $RootPID[$_SERVER['HTTP_HOST']],
'segTitleFieldList' => ,
'disablePathCache' => 0,
'firstHitPathCache' => 1,
'autoUpdatePathCache' => 0,
'dontResolveShortcuts' => 0,
),
//[snip]
);
Error: Reason: "some/url/" could not be found, closest page matching is
Reason: RealURL couldn't detect your rootpage_id Solution: If you use autoconf, add this to localconf.php:
$TYPO3_CONF_VARS['EXTCONF']['realurl']['_DEFAULT']['pagePath']['rootpage_id'] = '<uid of your root page eg. 1>';
With manual conf, just set rootpage_id inside pagePath array.

