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

  • Home
  • SEARCH
  • 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 99157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T00:20:02+00:00 2026-05-11T00:20:02+00:00

Well i need to make it so any user can have a foo.com/username in

  • 0

Well i need to make it so any user can have a foo.com/username in my site where i user a Zend framework.

The thing is that i want foo.com/login and other controllers to keep working as they do, so i already validate that no user can be named as one of the controllers im going to use. The htaccess cant be changed or the mvc configuration wont work. So im using the Router.

I know that if i use something like:

$routes = array();           $routes['entry']  = new Zend_Controller_Router_Route_Regex('SOME REGEX HERE',              array(                   'controller' => 'profile',                   'action'     => 'show'               ),               array(                   'id' => 'dsadsa', // maps first subpattern '(\d+)' to 'id' parameter                   1 => 'id' // maps first subpattern '(\d+)' to 'id' parameter               )           );    $router->addRoutes($routes);  

i can make it so everything that matches the regex is redirected, but i dont know if theres a better way(somehow chaining 2 routers) where i dont have to actually list my controllers in a very very big OR.

Any idea?

  • 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. 2026-05-11T00:20:03+00:00Added an answer on May 11, 2026 at 12:20 am

    Something like this should work:

    $routes = array();    $routes['entry'] = new Zend_Controller_Router_Route(     ':userName',      array(           'controller' => 'profile',           'action'     => 'show'       ) ); 

    Then add all of your other routes, for /login, /logout, etc. As Tim said, Zend matches routes in reverse order, so it will try to match against your ‘whitelist’ of routes prior to finally sending it to your ‘username’ route.

    This will break any type of error checking Zend does for making sure the controller/action exists, since everything will be routed to /profile/show if there are no route matches.

    All of this could be easily avoided, however, if you could just deal with foo.com/user/<username>.

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

Sidebar

Related Questions

I need a list of any well known Linux applications that uses object detection
I saw that in Eclipse I can define User Libraries - to make setting
I need a regular expression that will accept well-formed emails in several formats (see
I need a regular expression that should validate decimal point as well as range.
I have a media player that stops playing whenever the user closes the app,
I have a php script that gets user input (some text and a link),
I have inherited some code that is in need of a bit of a
i have an confirmation box where user can select OK to continue or Cancel
So I need to generate a code that can be tied to a specific
Well i need some help here i don't know how to solve this problem.

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.