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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:54:47+00:00 2026-06-06T14:54:47+00:00

I have a site in Zend Framework. I want to hide one particular controller

  • 0

I have a site in Zend Framework. I want to hide one particular controller name in the URL. Explaining the requirement below.

Current URL: http://abcd.com/user/john (which is a profile page of a user)

Preferred URL: http://abcd.com/john

The preferred URL will be displayed in the browser. Also, if a visitor types a username (for eg. http://abcd.com/smith) in the url, the browser will display the user profile.

I have some other controller as well in my site (for eg. http://abcd.com/registration) and don’t want to modify or hide those controller name.

I know this can be toodifficult to make a difference to recognise which is the username and which is the controller in the url, but i really want to accomplish this. Please suggest me the needful.

Please note that i am using the below html code to display user profile link.

<a href="<?php echo $site?>user/john">John</a>

Also added the below mentioned router in bootstrap.php file.

$routeUser = new Zend_Controller_Router_Route (‘user/:username/’,array(‘controller’ => ‘User’,’action’=> ‘index’));

$router->addRoute(‘user’, $routeUser);

  • 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-06T14:54:48+00:00Added an answer on June 6, 2026 at 2:54 pm

    Routes are checked in reverse order, so you can change user route to be just :username but then the router has no way of knowing that example.com/registration is not a user profile, which is why this would break your other route. The easiest way to fix this would be to add another route after the user route which handles the registration request:

    $router->addRoute('registration',
        new Zend_Controller_Router_Route('registration/:action', array(
            'module' => 'default',
            'controller' => 'registration',
            'action' => 'index'
        ))
    );
    

    Alternatively if you are fairly comfortable with ZF and want to handle the user requests properly without breaking the standard routes, you could create a custom route class specifically for your user profile requests. I wrote up a blog post a while ago on how to do this, see: http://tfountain.co.uk/blog/2010/9/9/vanity-urls-zend-framework

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

Sidebar

Related Questions

I have one module (site) in my zend framework app. What I am trying
I have a website built on Zend Framework. I want to run the site
I have make one site using Zend Framework. Its working fine in development server
I'm trying to develop a site using Zend Framework, but i have a problem:
I have a PHP5/Zend Framework 1.8.1 web site which is located at: http://www.example.com/foo The
We have a site built in Zend Framework and we're using the Zend Soap
Good day to all. I have a site (created with zend framework and smarty)
I have a zend site where DocRoot is set to public/ and URL as
We have taken on a site written in Zend framework. We didn't write the
The Zend Framework based site I have been working on is now being migrated

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.