-
Notifications
You must be signed in to change notification settings - Fork 126
Notes for Integrators
- Configuring root pages for RealURL
- Home page, root page and shortcuts
- Configuring languages
- Limitations
- Page titles
- Page types
- How do I set 'L' to the default language value without using it in the URL?
- My record titles are not unique. How do I use them in aliases?
- Excluding pages does not work
- My URLs still look like /index.php?id=12345. What's the problem?
- My URLs look like /46/. What's the problem?
- RealURL does not work!
- I see a lot of strange entries in the realurl module
- I found a bug...
Realurl URL needs to know where the root page of the site is. It is possible to let realurl know this in three different ways:
- By setting "Use as Root Page" in the page properties. This is enough if you have just one domain the installation.
- By setting domain records on root pages. Note that there should be all possible domains. For example, if you add
example.com
and forgetanother.example.com
, thananother.example.com
will not be known to realurl. Make sure that you configure domain records correctly: there should be only domain name in theDomain:
field of the domain record:www.example.com
is right,http://www.example.com/cms/
is wrong! - By specifying
rootpage_id
in thepagePath
section of the configuration. Please, see Configuration reference for more information.
Many people use a shortcut page named something like Home
on the first level of the site to make home page appear in menu. There are two ways to make it:
- Make root page a shortcut to a page named
Home
inside the root page. In this case the content of the site home page is not on the root page but on the page namedHome
on level 1. - Put content of the home page to the root page and create
Home
page on level 1 as a shortcut to the root page.
RealURL will work correctly only if you use the second way. If you use the first way, your URLs will look like /home/
for the home page (not /
as you may expect) and subpages on the first level may look like /home/subpage/
).
To repeat, the proper way:
- Put content of the home page to the root page
- Make a subpage named
Home
as a shortcut to your root page.
Note: you have to follow these instructions exactly. Doing otherwise most likely will cause you troubles.
There are two ways people use languages with RealURL. Assuming that main language is German and secondary is French, here are two possible scenarios.
First scenario is when default language is omitted from URL. Example URLs will look like:
- German: /ernaehrung/rezepte/rezeptsuche/
- French: /fr/alimentation/recettes/recherche-de-recettes/
Second case is when default segment also present:
- German: /de/ernaehrung/rezepte/rezeptsuche/
- French: /fr/alimentation/recettes/recherche-de-recettes/
Selection is up to the integrator and its customer. RealURL allows both.
For the first case you configure RealURL as follows.
'preVars' => array(
0 => array(
'GETvar' => 'L',
'valueMap' => array(
'fr' => 1,
),
'noMatch' => 'bypass',
),
),
config {
sys_language_uid = 0
language = de
}
[globalVar = GP:L = 1]
config {
sys_language_uid = 1
language = fr
}
[global]
For the second case configuration is different:
'preVars' => array(
0 => array(
'GETvar' => 'L',
'valueMap' => array(
'de' => 0,
'fr' => 1,
),
'noMatch' => 'bypass',
),
),
config {
sys_language_uid = 0
language = de
defaultGetVars {
L = 0
}
}
[globalVar = GP:L = 1]
config {
sys_language_uid = 1
language = fr
}
[global]
Note: if you do not configure languages like described here, you will not get correct URLs with realurl. It is not a bug. It just how it works.
RealURL cannot correctly decode URL if there are two pages on the same level inside the same parent page because it is an ambiguity. Example:
Home
|- News <-- standard page
|-- Single <-- standard page
|- News <-- folder
|-- Corporate <-- standard page
Here /news/corporate/
may not be available unless its entry exists in the cache. Decoding for news/corporate
will fail.
When excluding pages from URL, similar rules apply:
Home
|- Company <-- standard page but excluded
|-- News <-- standard page
|--- Single <-- standard page
|- News <-- folder
|-- Corporate <-- standard page
Here news/single
may not be decoded unless it exists in the cache. For realurl news/
is a folder in this page tree! Only of the News
page is absent on the level, where the excluded page exists, will realurl search under excluded pages.
RealURL does not decode subpages of the following page types:
- Separator. Separator pages are just visual separators in the menu. They should not have subpages. Use folders instead. This is a breaking change since realurl 1.x. It is made to enforce proper page tree structure.
- Recycler. Pages in the recycler are not visible on the site.
You should use both RealURL and TypoScript for that. RealURL configuration will look like:
array(
'GETvar' => 'L',
'valueMap' => array(
'fr' => 1,
'it' => 2,
),
'noMatch' => 'bypass',
),
TypoScript will look like:
config {
language = de
sys_language_uid = 0
}
[globalVar = GP:L = 1]
config {
language = fr
sys_language_uid = 1
}
[globalVar = GP:L = 2]
config {
language = it
sys_language_uid = 2
}
[global]
RealURL appends numbers in such cases. However if you clear caches, URLs may change because numbers are appended on "first come – first served" basis. If you want to ensure unique URLs, use uid as a part of the alias:
array(
'GETvar' => 'tx_myext_plugin[uid]',
'lookUpMap' => array(
...
'alias_field' => 'CONCAT(title, '-', uid),
...
)
)
It does but there is one case where it seems like it does not. The rule: if the page is the current page, it will not be excluded from the path even if the corresponding checkbox is set in page properties.
Example:
|- Home (id=1)
|-- News (id=2)
|--- Detail (id=3)
|-- Test 1
Path to news items in such cases usually look like /news/detail/news-item-title/
(assuming you use fixedPostVars
for news parameter). Typically people want to get rid of the detail
segment. However it is not possible.
Technical reason is quite simple. Given the path /news/news-item-title/
, what page is expected here? Is it a page with id=2 or a page with id=3? If you think that id=3, than what is the id for the /news/
path? Is it 2 or 3? Since RealURL cannot distinguish between such cases, the current page path segment cannot be excluded from the URL. If you have troubles what is current, think of the last segment of the page path (the one before news item title in the example above).
You forgot to enable RealURl in TypoScript using
config.tx_realurl_enable = 1
This does not happen with RealURL 2.x anymore. Upgrade from version 1.x to 2.x.
It does. Please, check you configuration and ask questions in TYPO3 mailing lists.
Often people report a "bug" that they see strange values in realurl data in the Backend. For example, they see URLs with and without cHash
or see strange L
values.
This is not a bug in realurl. Actually it is not related to realurl at all. It is about how you configure your site.
Realurl only converts urls that it receives from TYPO3. So if a "bad" URL appears in the realurl data, it means that TYPO3 asked realurl to encode such URL. This means that there is a piece of TypoScript, or a Fluid template, or a Fluid viewhelper, or PHP code that makes such "bad" URLs.
It is essential to understand these two points, so here they are again:
- Realurl only encodes what it gets from TYPO3
- Realurl has no way to know whether the URL is correct or not. It always encodes it as is and passes the encoded version back to TYPO3.
Why can such "bad" URLs appear? Usually they come from improper configuration in the TYPO3 implementation. Usually:
-
config.linkVars
does not have proper restrictions for theL
parameter. - The site uses
typolink.addQueryString
that bypassesconfig.linkVars
completely and can add any query string parameters to your links. The best thing to do is to avoidtypolink.addQueryString
completely or at least add an option to exclude some values liketypolink.addQueryString.exclude = L,cHash
. But this does not guarantee exclusion of any other arbitrary parameters. So this option should be avoided. Note that some Fluid viewhelpers use it, so issues may come from there too.
These problems are not unique for realurl. Even if you completely disable realurl, you may still have pages with wrong links due to points above. What you have to do is to be really careful and watch what you use and how. Security is very important these days and it should not be treated lightly.
I can add very little to this classic writing...
The first thing you do is you ask in the TYPO3 Slack channel. If nobody else has this problem, than you have to double check that you do everything correctly (configuration, root page flags, database up to date, etc). Only than you write it in the bug tracker and put as many details as you can.