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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T09:52:34+00:00 2026-06-16T09:52:34+00:00

I am working on cakephp project. I have removed index.php from URL using .htaccess

  • 0

I am working on cakephp project. I have removed index.php from URL using .htaccess file and now I want to remove view name from URL & add some other two varying parameter. Suppose I choose country & city then these two parameter should appear in URL on selecting them.

The problem I am facing is as cakephp takes

www.example.com/Controllername/viewname

But my requirement is like this

www.example.com/Controllername/param1/param2

If I pass this way It looks for param1 as controller and param2 as view.

Initially should be like:

www.example.com/Controllername/
  • 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-16T09:52:35+00:00Added an answer on June 16, 2026 at 9:52 am

    In your APP/routes.php:

    // www.example/com/Controllername
    Router::connect('/Controllername', 
        array('controller'=>'Controllername', 'action'=>'index'));
    
    // www.example.com/Controllername/param1/param2
    Router::connect('/Controllername/:param1/:param2',
        array('controller'=>'Controllername', 'action'=>'index'), 
        array('pass' => array('param1', 'param2')));
    

    and your controller:

    // set to null/a value to prevent missing parameter errors
    public function index($param1=null, $param2=null) {
       //echo $param1 . ' and ' . $param2;
    }
    

    When generating links:

    array('controller'=>'Controllername', 'action'=>'index', 'param1'=>'foo', 'param2'=>'bar');
    

    Order matters. Change paramX to anything you want i.e. country and town

    note this does not cover: controllername/param1 – both must be present in this example.

    There are other ways to achieve this.

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

Sidebar

Related Questions

I am using RPX in my CakePHP project. I have set the toke url
I am working on a CMS using CakePHP and I want to create a
I have a RESTful API set up and working with CakePHP using mapResources() and
let's say i have: http://some-domain/application/controller/action/parameter This is somehow working in cakePHP. Now I want
I am working on a CakePHP project that has a database populated from multiple
I'm using cakephp 2.1 just fine; I want to use jquery to have my
I am using postgres database in my cakephp project. I have a table with
I am working on a project in CakePHP. When we want to update a
I'm working on a Symfony project (my first) where I have to retrieve, from
I'm working on a CakePHP project and I have User, Post and Location models

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.