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 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

Well... that's it. I need something simple and reliable (doesn't have to have fancy
I need a JavaScript library that supports Ajax as well as help me in
Well this is incredibly frustrating. After being nagged by Rails that I need to
Well behaved windows programs need to allow users to save their work when they
I need to define new UI Elements as well as data binding in code
Well the docs finally said it, I need to take it easy on my
Well the subject is the question basically. Are there any version control systems out
I need to create a html parser, that given a blog url, it returns
I have a form that outputs systems assigned to a project. The systems are
I have made a program that finds and measures the radius of yeast colonies

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.