I am rewriting an old project using Symfony2, so I can try the framework. I have URLs that will take the form:
/profile/{id}
in that symfony2 does this. However, the same page was originally found:
/profile.php?id=12345
So, if someone has an old url, I would redirect those links. The problem is that I do not know how to catch routes of this kind. I tried
/profile.php?id={id}
but that didn't seem to work. How to configure this route?
Follow-up observation: I do not want to do catch-all (because it is not intuitive for me, so I am afraid of future errors), and I would prefer not to do this through htaccess for the same reason. I think the best option is to match "/profile.php" and then in the controller, check that "id" exists in the query string and is redirected accordingly. If it is not, I will go to 404.
source
share