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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:52:37+00:00 2026-05-26T06:52:37+00:00

eg my URLs and their resulting actions , will be like: 1) a: For

  • 0

eg my URLs and their resulting actions , will be like:

1) a: For a user whose company_id belongs to company = Pepsi

/pepsi/ - controller - users, action - dashboard (their Auth->user 'company_id' will be used and their user->id)

/pepsi/companies/view - controller - companies, action - view
/pepsi/users/ - controller - users, action - index (trailing slash preferably optional)
/pepsi/users/dashboard - controller - users, action - dashboard

1) b: For a user who company_id belongs to company = Coke

/coke/ - controller - users, action - dashboard
/coke/companies/view - controller - companies, action - view
/coke/users/ - controller - users, action - index (trailing slash preferably optional)
/coke/users/dashboard - controller - users, action - dashboard

2) For an admin, which uses routing prefix adminperson

/adminperson/users - controller - users, action - index
/adminperson/users/view/3 - controller - users, action - view , id = 3
/adminperson/companies/delete/6 - controller - companies, action - delete Id = 6

3) important Then also when a user isnt logged in , there are ALSO public pages.
/contents/view/3 – controller – contents, action – view AND id = 3

Below is the best I have got so far, but it always demands the action index to be explicitly written to the URL – but in fact I guess its not that bad a problem as the Html->link helper should produce it. I am happy to build all my links with the helper as I usually do that.

best try :

Router::connect('/:companyslug/:controller/:action', array('controller' => 'companies', 'action'=>'index', 'companyslug'=>'test'));
  • 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-26T06:52:38+00:00Added an answer on May 26, 2026 at 6:52 am

    I have a similar setup, except I’m keeping track of the first part of the route to determine what records are displayed. Here’s my setup, where “:app” is in place of what you call “:companyslug”:

    $app_names = "app1|app2|test_app"; // In real code these are pulled from a model
    
    Router::connect(
        '/:app/:controller/:action/*', 
        array( ), 
        array(
            'persist'=>array('app'),
            'app'=>$app_names
        )
    );
    
    Router::connect(
        '/:app/:controller', 
        array('action'=>'index'), 
        array(
            'persist'=>array('app'),
            'app'=>$app_names
        )
    );
    
    Router::connect(
        '/:app', 
        array('controller'=> 'pages', 'action'=>'display', 'home'), 
        array(
            'persist'=>array('app'),
            'app'=>$app_names
        )
    );
    
    // Allow non-app specific access. (I have disabled the default CakePHP routes.)
    Router::connect('/:controller', array('action' => 'index'));
    Router::connect('/:controller/:action/*');
    

    Note: this is from Cake 2.0RC3, but I believe it should work the same in 1.3.

    This way you can retrieve the value of app in the controller (under request parameters) and make sure they are in the correct URL (make sure company_id = companyslug in your case).

    One tricky bit is the ‘persist’ option, which means you always need to use the Html Helper’s link function to maintain the correct prefix in the URL.

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

Sidebar

Related Questions

Normally my URLs look like the standard: www.example.com/controller/action Now I want to setup my
It's of course nice to give users friendly URLs for their content on your
I want to hide the urls for editing users and their profiles behind safer
I have a container class for urls and their headers, Resource: class Resource(object): def
Example URLs http://www.youtube.com/user/Scobleizer#p/u/1/1p3vcRhsYGo http://www.youtube.com/watch?v=cKZDdG9FTKY&feature=channel http://www.youtube.com/watch?v=yZ-K7nCVnBI&playnext_from=TL&videos=osPknwzXEas&feature=sub http://www.youtube.com/ytscreeningroom?v=NRHVzbJVx8I Any regex that will pull the correct YID
How can I sanitize URLs made from strings to replace characters like space to
How to handle invalid URLs in MVC? For ex.: When the user enters http://localhost/User/MyProfile
When you are building URLs that should be legible for users and search engines
I'm tying to select images based on their URLs, but for some reason it's
Some web pages, having their urls, have Download Text, which are hyperlinks. How can

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.