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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:05:13+00:00 2026-05-28T08:05:13+00:00

This seems like a very simple question, but I’ve only found complicated answers. I’ve

  • 0

This seems like a very simple question, but I’ve only found complicated answers. I’ve got a Zend Framework application that requires users to login. The loginAction() and logoutAction() are defined in AuthController. I want to allow users to login via http://www.example.com/login rather than http://www.example.com/auth/login.

I know there are numerous ways of doing this, the 3 I’ve considered are:

  1. .htaccess rewrite
  2. Creating a LoginController and redirecting the indexAction() to auth/login
  3. Defining my own routes using Zend_Controller_Router_Rewrite.

I’d rather keep it out of #1 if possible. #2 is easy enough to understand, although it seems like a hack. It also could clutter the code with a bunch of 5-line “Controller” classes. I think #3 is the way to go but I don’t fully understand how to use it effectively. I have tried Using Zend_Config with the RewriteRouter although I only defined the login route so every link became ‘/login’ (I think I was missing a default route). I did this in my Bootstrap.php, I’m not sure if that was correct.

Is there a simple approach I’m missing? Am I using #3 incorrectly? Are there tutorials for this that I should read? (I’ve looked at the Zend documentation which is good but often I find myself asking, ‘Where should this code go: in a controller, model, bootstrap, other?’)

  • 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-28T08:05:14+00:00Added an answer on May 28, 2026 at 8:05 am

    for a defined purpose like you have a “named” route would be the simplest way to do it. While there are any number of ways to implement a named route the easiest is to put it in the application.ini:

        // /application/configs/application.ini
        resources.router.routes.login.route = /login
        resources.router.routes.login.defaults.module = default
        resources.router.routes.login.defaults.controller = auth
        resources.router.routes.login.defaults.action = login
    

    putting it in your bootstrap is not wrong, it just doesn’t seem as convienient to me.
    Also doing it this way should (no guarantees) prevent any problems with the default routes.

    When calling a route using the url() helper it is important to remember to use either the named route :

    <?php echo $this->url(array(), 'routeName') ?>
    

    or if you need to pass the normal ‘controller’ => , ‘action’ => :

    <?php echo $this->url(array('controller' => 'index', 'action' => 'index'), 'default') ?>
    

    near as I can tell ‘default’ in this context indicates this would be a default route as defined in Zend/Controller/Router/Route/Module.php

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

Sidebar

Related Questions

This seems to me like a very simple question, but I can't seem to
This seems like a very simple question, but I'm getting lost, and need a
This seems like a very simple question, but I think hours of staring at
This seems like a simple question, but I can't find it with the Stack
This seems like perhaps a naive question, but I got into a discussion with
Seems like a very simple question here: I've got a program where someone is
This seems like it would be a simple question but I keep running into
This seems like a simple question to ask but, is it generally a good
This probably seems like a very simple question, and I would probably know if
This seems like a very simple and a very common problem. The simplest example

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.