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 8316179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:18:06+00:00 2026-06-08T21:18:06+00:00

This issue is very common appears here in SO many times but not for

  • 0

This issue is very common appears here in SO many times but not for Symfony2 framework. I want to create a rout that take the username directly after the domain to have access to the the user profile, like that: domain.com/username. Rout should be:

Profile:
    pattern: /{pseudo}
    defaults: { _controller: **Bundle:Default:member } 

However it’s clear that this rout will much other routs like /main, too bad. Documentation says that we can make some restriction to the pattern like making pseudo to be exactly En or Fr:

Profile:
    pattern: /{pseudo}
    requirements:
        pseudo:  en|fr

I may use this to make pseudo not equals to other similar routs like main , messages , post , blog but also I have much routs, router will look ugly. If this is a valid way, please show how to make requirements should not equal main, messages,...
Or there is another way, I’ll be thankful to know it.

  • 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-06-08T21:18:09+00:00Added an answer on June 8, 2026 at 9:18 pm

    You probably should not restrict it on the routing level but on the user register process. If you place the /{pseudo} route after all the other routes (like your /main or /messages route) the pattern only matches all requests that do not match any of your other routes.

    e.g.

    main:
        pattern: /main
        defaults:  { _controller: YourBundle:Main:show }
    
    % put all the other routes here
    
    % your very last route
    pseudo:
        pattern: /{pseudo}
        defaults:  { _controller: YourBundle:User:show }
    

    You may also add a requirement to that last route to contain only e.g. 8 characters and only alphanumeric values or whatever you like with regular expressions.

    requirements:
        pattern: ^\[a-z0-9]{,8}$
    

    However, iff you really want to restrict access via requirements, you may just add a requirement regular expression which disallows some names. Nonetheless I’d highly recommend not to:

    requirements:
        pattern: ^(?!main|messages|...)$ 
    

    This is also explained in detail in the documentation.

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

Sidebar

Related Questions

I know its a very common issue but I am not getting the exact
I made a research and all posts here are very blury regarding this issue.
Would very much appreciate some assistance with this issue. I use the following common
I hit this issue regularly but here is an example.... I have a Order
I know my issue is very common and similar types has been asked many
I find git docs very cryptic regarding this issue. I want to do a
Although it seems to be a very common issue, I did not harvest much
I know this is a very commun issue, but as I didn't forget any
I realize this is an unbelievably common issue and have looked very very thoroughly
I'm very surprised this issue hasn't been discussed in-depth: This article tells us how

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.