I’m using a website running TYPO3 6.2 with Realurl extension.
In the tree I created a "Cars" page with ID #66 and with "cars/" as speaking url path segment. My page is now available with https://www.mywebsite.com/cars/
. Cool.
What I need, if going on https://www.mywebsite.com/cars/audi
, is to retrieve the audi
as a GET variable (GP:car_brand) in Typoscript but current Typo3 default behavior is to search for a audi
page below the existing cars
page… and then display a 404 error.
What I have already tried:
1/ Adding a RewriteRule inside the .htaccess: RewriteRule ^cars/(.*)$ /index.php?id=66&car_brand=/$1 [P]
. It works but the user is redirected to https://www.mywebsite.com/cars/?car_brand=audi
, and we really need to keep the cars/audi/
URL scheme which is more SEO compliant / user friendly.
2/ Adding custom configuration inside my realurl_conf.php postVarSets but realurl is very hard to understand and I don’t have the technical skills to deal with it:
<?php
'postVarSets' => [
66 => array(
array(
'GETvar' => 'car_brand',
'valueMap' => array(
'no-comments' => 1
),
'noMatch' => 'bypass',
)
),
...
]
2
Answers
May be you can try something like this :
So the URL will look like this
https://www.mywebsite.com/cars/brand/audi
May be there is also a solution with fixedPostVars to avoid the ‘brand’ segment but in that case, the get parameter ‘?car_brand=xxx’ must be always set so I think it not possible to have only : https://www.mywebsite.com/cars
Or another solution could be to use a userFunc, then you can manage yourself the URL encoding/decoding.
Florian
To add a userFunc, have a look there :
https://github.com/dmitryd/typo3-realurl/wiki/Configuration-reference#userfunc
In realurl_conf.php :
In your class :