Open xini opened 9 years ago
I encountered the same issue myself. Got it working by adding the following to my Page (or HomePage) init method:
public function init() {
$requestVars = $this->getRequest()->getVars();
// In my case i needed to redirect /?id=THE_ID
if (array_key_exists('id', $requestVars)) {
$this->httpError(404);
}
parent::init();
}
The problem is that, the redirect script starts looking for possible redirects only when faced with an 404 httpError. So if the url looks like this: www.example.com/?id=1
it wil not redirect because it finds the home page, thus nothing happens.
Another problem i faced here was in the setup of the redirects, at first i had set up my table like this;
FromBase, FromQueryString, To
/, id=1, /some-other-page/
But it could not find the base /
because it apparently looked for /home
so by forming the table like so;
FromBase, FromQueryString, To
/home, id=1, /some-other-page/
It al worked like a charm.
I don't think this is a solution though, more of a workaround until the issue is fixed. Maybe the query string fields can be checked and when in use the 404 error could be thrown?
I haven't managed get the redirects working where there is only parameters from the root, i.e.
/?page-id=xy
. Is that possible? If not, any hints to what to change? Thanks.