Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6561069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:32:31+00:00 2026-05-25T13:32:31+00:00

I am re-writing an old project using Symfony2 so I can try out the

  • 0

I am re-writing an old project using Symfony2 so I can try out the framework. I have urls that will be of the form:

/profile/{id}

in the snazzy way that Symfony2 does it. However, the same page was originally found by doing:

/profile.php?id=12345

So, in case someone has an old URL, I’d like to redirect these links. The problem is, I don’t know how to catch routes of this nature. I tried

/profile.php?id={id}

but that didn’t seem to work. How can I set up this route?

Follow-up: I do not want to do “catch-all” (because it is non-intuitive to me so I fear future bugs), and I would prefer not to do it via htaccess for the same reason. I think the best option is to match “/profile.php” then in the controller, check that “id” exists in query-string and redirect accordingly. If it does not, I will redirect to 404.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T13:32:31+00:00Added an answer on May 25, 2026 at 1:32 pm

    I see two options here:

    1. You map your old schema (/profile.php?id=54321) onto the new (/profile/54321) using mod_rewrite (in case you use Apache).

    2. You write a mapper within Symfony. That means at the end of your list of routes you specify a pattern that will just catch everything not yet catched:


    whatever:
      pattern: /{whatever}
      defaults: { _controller: CoreBundle:Default:whatever }
      requirements:
        whatever: .+
    

    For (2) you will have to check what the Request-object offers you for the queries (like getQueryString()), b/c I am not sure if it is possible to have something like ?xyz being matched in a route.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a new project, and I have a choice between using a library
Im writing html and css in an old web application that is using the
As a side project I'm currently writing a server for an age-old game I
I'm writing a bash script that needs to delete old files. It's currently implemented
Writing a JSP page, what exactly does the <c:out> do? I've noticed that the
The application I'm currently writing is using MVVM with the ViewModel-first pattern. I have
I am looking for a form class that: Is standalone/doesnt need a framework to
I'm experimenting with writing ActiveX controls and noticed that I can't seem to create
I have a project that I want to put onto Git. We have many
I have an existing J2EE project which is very big and old. Therefore, my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.