We recently updated our site from pure php to cakephp 3 and having trouble redirecting urls that have params to a new url.
For example this redirect works fine
The router doesn't support matching on query strings, the URL passed to the router when checking for a matching route won't have any query string values attached anymore.
While it would be possible to workaround this by using a custom routing dispatcher filter, a custom/extended Router
class, and a custom/extended RouteCollection
class, this seems like way too much work for something that can easily be defined as for example a rewrite rule on server level.
Apache mod_rewrite
example:
RewriteCond %{QUERY_STRING} ^id=100$
RewriteRule ^webcast\.php$ /webcast? [L,R=302]
And note that 301 is usually the preferred redirect method.
See also