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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:40:36+00:00 2026-05-29T09:40:36+00:00

I have an app that uses several prefixes and, while not frequent, it’s also

  • 0

I have an app that uses several prefixes and, while not frequent, it’s also not unusual to add a prefix as we go along. What makes this painful is that the Router::url() method, by default, assumes that any url built should inherit the prefix of the current page if no prefix is explicitly specified.

This appears to be a very deliberate action so I’m assuming that the majority of folks find it more useful than not, but I find it much more readable/maintainable to simply construct my URLs with prefixes where the URL needs one and leave it off when it doesn’t. Long ago, I created AppHelper::url() to override Helper::url() which assumes nothing and only builds a URL with a prefix when it’s explicitly requested and that’s a huge help for links generated in views.

There is, however, another scenario that I’d like to override and haven’t found a “clean” way to go about it. Consider an unauthenticated user who’s bookmarked a link to an admin resource (e.g. /admin/thing_that_needs_to_be_administered/some_action). S/he clicks that bookmark, but isn’t logged in so s/he gets redirected. Instead of being redirected to /users/login, s/he’s sent to /admin/users/login which doesn’t exist. Whoops.

Has anyone else found a way of doing this that they really like? The idea is to not have to explicitly set each prefix to false everywhere that redirection is done. That is just way too much maintenance when a prefix is added.

I think this gets easier in Cake 2, but we’re running on Cake 1.3.

Any thoughts would be much appreciated.

  • 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-29T09:40:37+00:00Added an answer on May 29, 2026 at 9:40 am

    I would suggest trying this route if you have not already:

    EDIT: Sorry, loginAction

    <?php
        $this->Auth->loginAction = array('controller' => 'users', 'action' => 'login', 'admin' => false );
    ?>
    

    That will explicitly set the login url.

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

Sidebar

Related Questions

I have an app that uses a tableview, along with a UIButton that I
I have an app that uses a TabHost. Several of the Tabs share a
I have an app that uses several different user defaults that need to be
So, I develop the app that uses sqlite3 database methods. I have several view
Basically I have created a Blackjack app that uses several methods that get called
We have an app that uses simple one way binding with a GridView to
I have an app that uses EF. To test my stuff I generally wrap
I have an app that uses the python/c api and I was wondering what
I have a App that uses the In App feature. -(void) completeTransaction: (skPaymenttransaction *)transaction{
I have an app that uses the iPhone camera and puts an overlay over

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.