Questions tagged [cakephp-routing]

Routing is a feature that maps URLs to controller actions.

It was added to CakePHP to make pretty URLs more configurable and flexible. Using Apache’s mod_rewrite is not required for using routes, but it will make your address bar look much more tidy.

Routes in an application are configured in app/Config/routes.php.

Manual Reference.

Example:

Router::connect(
    '/pages/*',
    array('controller' => 'pages', 'action' => 'display')
);

This route is found in the routes.php file distributed with CakePHP. This route matches any URL starting with /pages/ and hands it to the display() action of the PagesController(); The request /pages/products would be mapped to PagesController->display('products').

46 questions
0
votes
1 answer

When parameter is not passed to controller over url

In cakephp, I've a controller that should receive a parameter and then call model to work with database to show the result in a view. Pretty common mvc approach. Imagine the controller as "Insert a new post" which should be associated to an specific…
goodguy_cakephp
  • 243
  • 1
  • 4
  • 13
0
votes
2 answers

CakePHP routing to controller and page

Is it possible to identify a controller and pagename in the same url Router::connect('/:controller/'); Router::connect('/:pagename/', array('controller' => 'home','action'=>'index')); www.example.com/controller so that the controller goes to the…
Saneesh B
  • 572
  • 4
  • 13
0
votes
1 answer

CakePHP doesn't redirect properly

I've just finished the Getting started tutorial (http://book.cakephp.org/2.0/en/getting-started.html) and put my files on an Apache server, that has Drupal projet as root URL. The Cakephp's index page loads fine, but when I click on any item,…
user2094540
0
votes
2 answers

cakePHP- Role Authorization and Routing

I am completely and utterly lost on how to do this. I have 3 different roles : Admin, Staff and Donors. My problem is that It really gets confusing(for me anyway) with permissions and as well as appropriate redirections, should an unauthorized user…
LogixMaster
  • 586
  • 2
  • 11
  • 36
0
votes
3 answers

CakePHP multilingual static pages

I have created a multilingual application in CakePHP 2 I want to include some static content in different languages and I'm having trouble setting up the routing. I have it working for language/controller/action type routes but if I want to have…
Devin Crossman
  • 7,454
  • 11
  • 64
  • 102
0
votes
1 answer

cakephp: seo friendly url routing - avoid the url parameter passed

I am working hard to get my seo routing working. Right know I am able to build such url: http://mydomain/Rentals As soon as I need to use the pagination, I get urls like this http://mydomain/Rentals/page:2?url=Rentals I can't figure out what I…
user1555112
  • 1,897
  • 6
  • 24
  • 43
0
votes
1 answer

cakephp redirect url behaving strangely

I'm not sure exactly where to start looking for how to fix or what it is I need to fix so hopefully someone can give me a pointer. I have some basic authentication working but the url I want to redirect to is becoming something else along the way.…
dstewart101
  • 1,084
  • 1
  • 16
  • 38
0
votes
1 answer

Structuring "nested" controllers

I'm looking to structure my application the best way possible. I'm adding a "Services" section to my application. This will consist of an index method, and multiple services that are supposed to be reached through /service/service1/ or…
joakimdahlstrom
  • 1,575
  • 1
  • 11
  • 23
0
votes
1 answer

cakephp don't display index action in url

I'm using the following code in my AppHelper.php to inject the language parameter into links created with the HtmlHelper public function url($url = null, $full = false) { if(!isset($url['language']) && isset($this->params['language'])) { …
Devin Crossman
  • 7,454
  • 11
  • 64
  • 102
0
votes
0 answers

cakePHP routing with parameters and prefix

I'm using an admin prefix and I want to pass some parameters to my controller but I'm having a hard time with the routing. I want to pass variable "string1" using the url like: domainame.com/admin/DumbController/string1 I want the string1 to be…
user6972
  • 851
  • 1
  • 15
  • 32
0
votes
1 answer

Cakephp rewrite rule

I have url Microsites/index. With action index I want to pass parameter like 1001.So, crated rule for it as given below: Router::redirect('/Microsites', array('controller' => 'Microsites', 'action' => 'index',1001)); It working fine & shows url in…
Rohit
  • 403
  • 3
  • 15
0
votes
1 answer

CakePHP, Routing for optional controller using generic controller otherwise

I'd like to make an application in CakePHP which manages exercises and users results. Users and results are not important in this question. I want to have a possibility to add an exercise with adding only a specific table and line to .ini config…
0
votes
1 answer

CakePHP dynamic homepage based on domain name

I'm looking to change the homepage of my app based on the domain name. Domain name x.com (our main app domain) to link to: controller: pages | action: home Domain name y.com or z.com (stores created via our main app domain) to link to: controller:…
iDev247
  • 1,761
  • 3
  • 16
  • 36
-1
votes
2 answers

Routing In Simple PHP from Navigation Menu

I have the root project-folder. Where each php files are in specific folder. For each nav items, I have passed the php page through href="" tag. When I click on the nav item it then takes me to the requested page as passed in href. But when from…
Ashutosh dwivedi
  • 510
  • 3
  • 16
-1
votes
1 answer

page redirection in cakephp not working

I am a beginner in CakePHP and am working on an existing CakePHP site. Scenario: is whenever I try to access a page directly through URL, it lands on Login page. For instance this is my register page. It has a submit button. When I click this submit…