Search

I got a news page with parameters cat/title. Optional there is an url parameter to filter on a tag. For one tag I like to have a short url. For example: /blog/ to /news/?tag=blog

When I put this into the url router and take a look in the debug view the normal page parameter cat get the value of the GET paramet: <cat>?cat=blog</cat>. The GET parameter is completely ignored that way.

How can I route with a GET parameter while it is still functioning as GET parameter or isn't it possible?

Query parameters are normally handled by the controller and not by the router. Symphony doesn't have controllers, but you could write a custom event to perform the action you need.

I don't understand it completely.

Besides that a custom event is out of the scope for this project. An extra page and datasource could solve it also but doesn't give the flexibility I like to have.

The link /news/?tag=blog functions as expected. When I route the url the behaviour changes. Thus if you route an url only the url path route and not the query parameters?

Making the rewrite in the htaccess with the QSA flag does solve it

RewriteRule ^blog http://www.domain.com/news/?tag=blog [L,QSA]

EDIT grmblr not that is a redirect and not a silent route

Ah the http part makes it external. The QSA wasn't neccessary also.

RewriteRule ^blog /news/?tag=blog [L]

Was the fix.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details