TYPO3 - realurl is ignoring created/own extension - typo3

I have a running TYPO3 installation (7.6) with with the latest realurl and news extension. All working fine. I now created a simple extension tx_ffscarexample and struggling to manipulate the paths for it. In tx_ffscarexample I have 'list, show, new, create, edit, update, delete' actions. Now, when first calling the page /car-example/ with the List View ... my path looks like:
List View
/car-example/
... I get all records showing in a table.
But already when I hover over the links I get like
/car-example/?tx_ffscarexample_carlist[car]=3&tx_ffscarexample_carlist[action]=show&tx_ffscarexample_carlist[controller]=Car&cHash=0b3f5b986dsdf95f33465e3d324e1e83a
When I then go into a detail view ... I get e.g.
Show View
/car-example/?tx_ffscarexample_carlist[car]=3&tx_ffscarexample_carlist[action]=show&tx_ffscarexample_carlist[controller]=Car&cHash=0b3f5b236dd5295f5f6234d324e1e83a
New View
/car-example/?tx_ffscarexample_carlist[action]=new&tx_ffscarexample_carlist[controller]=Car&cHash=4df2347378f318530423761f7627394a6
Edit View
/car-example/?tx_ffscarexample_carlist%5Bcar%5D=15&tx_ffscarexample_carlist%5Baction%5D=edit&tx_ffscarexample_carlist%5Bcontroller%5D=Car&cHash=72344542eaf1c64c12347dd3c7714
List View
/car-example/?tx_ffscarexample_carlist[action]=list&tx_ffscarexample_carlist[controller]=Car&cHash=23d56247c27805c2c234c8c23353c7e
In realurl_conf.php I've added for the extension:
...
'postVarSets' => array(
'_DEFAULT' => array(
'car' => array(
array(
'GETvar' => 'tx_ffscarexample_carlist[action]',
'valueMap' => array(
'list' => 'list',
'show' => 'show',
'new' => 'new',
'edit' => 'edit',
'create' => 'create',
'delete' => 'delete',
'update' => 'udpate'
),
'noMatch' => 'bypass'
),
array(
'GETvar' => 'tx_ffscarexample_carlist[controller]',
'valueMap' => array(
'car' => 'car',
),
'noMatch' => 'bypass'
),
array(
'GETvar' => 'tx_ffscarexample_carlist[car]',
'lookUpTable' => array(
'table' => 'tx_ffscarexample_domain_model_car',
'id_field' => 'uid',
'alias_field' => 'name',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-'
),
'languageGetVar' => 'L',
'languageExceptionUids' => '',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'autoUpdate' => 1,
'expireDays' => 180,
)
)
),
),
)
...
What am I missing?
What I would like to have is sth like ...
/car-example/car/
/car-example/car/new
/car-example/car/audi/
/car-example/car/audi/edit/
/car-example/car/audi/delete/
/car-example/car/bmw/
/car-example/car/bmw/edit/
/car-example/car/bmw/delete/
Seems like here are similar issues:
typo3 7, bootstrap_package, RealUrl and own extension

Fixed it. What I did was:
I deactivated and removed the extension.
Deleted typo3temp and all realurl tables.
Cleared caches in InstallTool
Installed the extension again.
-> Now everything works as expected
*Please make copies of records and tables before removing them just in case.
It might be due to the installation order:
"The order you will install the extensions matters! Make sure the RealURL extension is installed first, then the bootstrap package and afterwards the rest of the extensions which contain RealURL rules including your new one." (Source: https://aimeos.org/tips/tag/realurl/ )

Related

Typo3 RealURL tx_news 403 error on detail page with banner link

I have problems with my RealURL Configuration and can't find a solution. I have included banners in my site, but on the news detail pages the link does not work, creating a 403 error. So there has to be something wrong with my RealURL configuration:
'fixedPostVars' => array(
'newsDetailConfiguration' => array(
array(
'GETvar' => 'tx_news_pi1[news]',
'lookUpTable' => array(
'table' => 'tx_news_domain_model_news',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-'
),
'languageGetVar' => 'L',
'languageExceptionUids' => '',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'autoUpdate' => 1,
'expireDays' => 180,
)
)
),
'18' => 'newsDetailConfiguration',
The link when clicking on the banner looks like this:
/detail/?type=9002&tx_sfbanners_pi1[banner]=4&tx_sfbanners_pi1[action]=click&tx_sfbanners_pi1[controller]=Banner&cHash=5ab32cd1edb0529752985d5e30dfd8be
Thanks for your help!
The parameters of EXT:news are missing and need to be added when you create the link of the banner

Realurl create paths with several parts like detail/land-1/name-1

I have an extension for items, each has several fields. One field is name and one field is country.
In realurl_conf.php i can create a url like:
detail/name-1
with:
name' => array(
array(
'GETvar' => 'tx_myext_myplugin[model]',
'lookUpTable' => array(
'table' => 'tx_myext_domain_model_model',
'id_field' => 'uid',
'alias_field' => 'name',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-',
),
),
),
But what if i also want to have the country in the url, like:
detail/country-xy/name-1
How can i achieve this?
Realurl can only map arguments which are available. Therefore you must also provide the country to the typolink generation.

Typo3: RealURL and Ext:news – News URLs are not rewritten

I'm runnning Typo3 6.2.4 with RealURL 1.12.8 and News (tx_news) 3.0.1. Using the automatic configuration from RealURL rewrites the URLs for "normal" pages, but not for news. The generated links look like this:
index.php?id=5&tx_news_pi1%5Bnews%5D=4&tx_news_pi1%5Bcontroller%5D=News&tx_news_pi1%5Baction%5D=detail&cHash=706379a0ef43d4020448c5193f865bf1
This is what automatic configuration gives me. I've just inserted the part from http://docs.typo3.org/typo3cms/extensions/news/Main/Administration/Realurl/Index.html. At the moment I'm not interested in creating a special kind of rewritten URL, I just want to get RealURL rewrite the news URLs. Once that's running, I think I'll get the rest figured out.
<?php
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']=array (
'_DEFAULT' =>
array (
'init' =>
array (
'enableCHashCache' => true,
'appendMissingSlash' => 'ifNotFile,redirect',
'adminJumpToBackend' => true,
'enableUrlDecodeCache' => true,
'enableUrlEncodeCache' => true,
'emptyUrlReturnValue' => '/',
),
'pagePath' =>
array (
'type' => 'user',
'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
'spaceCharacter' => '-',
'languageGetVar' => 'L',
'rootpage_id' => '1',
),
'fileName' =>
array (
'defaultToHTMLsuffixOnPrev' => 0,
'acceptHTMLsuffix' => 1,
'index' =>
array (
'print' =>
array (
'keyValues' =>
array (
'type' => 98,
),
),
),
),
'postVarSets' =>
array (
'_DEFAULT' =>
array (
// EXT:news start
'news' => array(
array(
'GETvar' => 'tx_news_pi1[action]',
),
array(
'GETvar' => 'tx_news_pi1[controller]',
),
array(
'GETvar' => 'tx_news_pi1[news]',
'lookUpTable' => array(
'table' => 'tx_news_domain_model_news',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-',
),
'languageGetVar' => 'L',
'languageExceptionUids' => '',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'autoUpdate' => 1,
'expireDays' => 180,
),
),
),
// EXT:news end
),
),
),
);
It turned out that my realurl_conf.php was correct, but the TypoScript configuration part was missing. As soon as I put those lines in the template setup of my root page, Typo3 started to rewrite the URLs:
config.absRefPrefix = /
config.tx_realurl_enable = 1
config.uniqueLinkVars = 1
# dont forget to set the allowed range - otherwise anything else could be inserted
config.linkVars = L(0-3)
Source:
http://wiki.typo3.org/Realurl/manual#TypoScript_configuration
http://docs.typo3.org/typo3cms/extensions/realurl/Realurl/Configuration/HandlingRelativeLinksWithSpeakingUrls/Index.html

realUrl not writing preVar for default language

I am running realURL 1.12.6 on TYPO3 4.5.26
I am used to realURL creating paths that contain the preVar also for the default language, like www.example.com/de/seite/ and www.example.com/en/page/
In one case, this is just not happening - or I think, only sometimes.
In most of the cases, I get www.example.com/seite/ and www.example.com/en/page/
Where can this be changed?
PS: Here's the beginning of my realurlconf:
$TYPO3_CONF_VARS['EXTCONF']['realurl']['_DEFAULT'] = array(
'init' => array(
'enableCHashCache' => 1,
'appendMissingSlash' => 'ifNotFile',
'enableUrlDecodeCache' => 1,
'enableUrlEncodeCache' => 1,
'respectSimulateStaticURLs' => 0,
//'postVarSet_failureMode'=>'redirect_goodUpperDir',
),
'redirects_regex' => array (
),
'preVars' => array(
array(
'GETvar' => 'L',
'valueMap' => array(
'de' => '0',
'en' => '1',
),
'valueDefault' => 'de',
'noMatch' => 'bypass',
),
array(
'GETvar' => 'no_cache',
'valueMap' => array(
'no_cache' => 1,
),
'noMatch' => 'bypass',
),
),
If I use this configuration (valueDefault is set, noMatch not) then 404 error page is not triggered when calling urls like
www.domain.com/notexisting/someexistingpage/
or
www.domain.com/notexisting/
The 404 page is only triggered when calling urls like
www.domain.com/notexisting/alsonotexistingpage/
That means, realurl expects the first part of the url to be the language part (here: "notexisting") and if realurl can't map this key, it uses the "valueDefault". But I want the 404 to be triggered, how can I achieve this?
Edit: I've the solution now:
realurl config:
'GETvar' => 'L',
'valueMap' => array(
'en' => '0',
'de' => '1',
),
'noMatch' => 'bypass',
TypoScript config:
config.defaultGetVars.L = 0
config.linkVars = L
Remove 'noMatch' => 'bypass', from your preVar configuration. The GET-Parameter "L" is not set to "0" if you open "www.example.com", so then the noMatch just bypasses the preVar configuration. If you only set valueDefault, it should work fine.

TYPO3 RealURL postVarSets hide keyword

I have an URL which looks like this:
http://domain.com/leistungen/industrial-design/?tx_fsproject_fsprojectfp%5Bproject%5D=2&tx_fsproject_fsprojectfp%5Baction%5D=show&tx_fsproject_fsprojectfp%5Bcontroller%5D=Project&cHash=7c405bcde49853af9a7e78bdf465002c
Using RealURL with the following configuration (and some hook functions as explained here):
'postVarSets' => array(
'_DEFAULT' => array(
// projects
'industrial-design' => array(
array(
'GETvar' => 'tx_fsproject_fsprojectfp[controller]',
),
array(
'GETvar' => 'tx_fsproject_fsprojectfp[action]',
),
array(
'GETvar' => 'tx_fsproject_fsprojectfp[project]',
'lookUpTable' => array(
'table' => 'tx_fsproject_domain_model_project',
'id_field' => 'uid',
'alias_field' => 'title',
'addWhereClause' => ' AND deleted !=1 AND hidden !=1',
'useUniqueCache' => 1,
'useUniqueCache_conf' => array(
'strtolower' => 1,
'spaceCharacter' => '-',
)
)
),
),
),
),
I get an URL looking like this:
http://domain.com/leistungen/industrial-design/industrial-design/projekt/project-b/
This is not bad. However, why does the industrial-design/ part show up twice?
The first industrial-design is the page that is being displayed. The second one is the keyword inserted by RealURL to identify the set of variables. To avoid that you can:
Change the structure of pages so that you don't have industrial-design page at all.
Rename the postVarSets that you set up in the RealURL configuration.
Use fixedPostVars instead as that doesn't use a keyword to identify the set of variables but a page UID.