Questions tagged [codeigniter-routing]

Questions about routing a particular URI, or pattern of URIs to a controller class and method, within the CodeIgniter PHP framework.

In CodeIgniter routes are defined in the application/config/routes.php file. Routes can simply be added to the array $route. CodeIgniter supports both wildcard and regular expression based routing rules in addition to static ones.

Read more in the CodeIgniter documentation.

245 questions
23
votes
3 answers

How to route 2 parameters to a controller?

This seems really basic but i can't get the hang of it. I'm trying to send more then one parameter to a method in the controller, like this : http://localhost/ci/index.php/subjects/3/state This is the routings i've tried : $route['subjects/(:num)']…
eric.itzhak
  • 15,752
  • 26
  • 89
  • 142
14
votes
2 answers

CodeIgniter: Is it possible to remove index.php without using .htaccess?

For technical reasons, I don't want to use .htaccess to remove index.php from URL in CodeIgniter. I have seen the route section. I also tried with a route like this: $route['(:any)'] = 'index.php/$1'; But it is not working. Is it possible to…
itskawsar
  • 1,232
  • 1
  • 19
  • 30
8
votes
3 answers

Codeigniter Setting Homepage ( Default Controller )

I'm trying to implement page templating in my codeigniter application, templating is working fine for instance, i have a blog page, which i'm trying to assign as my homepage, with different view and pagination and so on. When i write…
user1621727
8
votes
1 answer

Debugging routes in codeigniter?

I am wondering if there is any simple way of debugging routes in code igniter? preferably I would like to be able to see in the log along the lines of: Client sent : apps/something Route found : apps/(:any) -->…
Hailwood
  • 89,623
  • 107
  • 270
  • 423
7
votes
7 answers

Code Igniter Function Call 404

I was going through the official Code Igniter tutorial when I hit a snag... The tutorial had me save and run this code:
Jarrod
  • 71
  • 3
7
votes
6 answers

Removing index.php in CodeIgniter using .htaccess file

I'm currently developing a website using CodeIgniter and I recently stumbled upon a routing & .htaccess problem. Basically, the structure of my simple website (let's call my project 'CIExample' for the sake of simplicity) is as follow: -Home -About…
Stan
  • 81
  • 1
  • 2
  • 5
6
votes
3 answers

Passing parameters to controller's constructor

I have a controller which has several methods which should all share common informations. Let's say my URI format is like…
Matteo Riva
  • 24,728
  • 12
  • 72
  • 104
5
votes
4 answers

CodeIgniter: adding parameters to URL

Started my first CI project and am just wondering how I handle URL parameters? I have a controller named 'city', and I've modified my mod_rewrite so localhost/codeigniter uses rewrite to localhost/codeigniter/city. What I want to do is add a city…
iamjonesy
  • 24,732
  • 40
  • 139
  • 206
5
votes
1 answer

product detail page routing in codeigniter

In my local site http://localhost/giftsware/nl/products/details/2382 This is my browser url for product description page now I want more user friendly url for product description page. I want to change above url to…
5
votes
2 answers

Routes in Codeigniter - 404 Page Not Found

Can someone tell me, where the issue is ?? This is my controller class Support extends CI_Controller { public function __construct() { parent::__construct(); $this->load->model('support_model'); $urlarray =…
Satish Ravipati
  • 1,431
  • 7
  • 25
  • 40
5
votes
1 answer

Codeigniter routing causes function to be called multiple times

I have a function called "insert" in my categories controller. When I call the function via url like this: /categories/insert it works OK, but if I call the function like this: /categories/insert/ (slash at the end) the function is called three…
Andrej
  • 415
  • 1
  • 7
  • 25
4
votes
2 answers

Setting codeigniter routes for language path

So I am using a Codeigniter 2.1 Internationalization i18n Library and I need to adapt my routes to use the language parameters in my short urls where I remove the controller's name: $route['default_controller'] =…
Alex
  • 7,538
  • 23
  • 84
  • 152
4
votes
1 answer

Regexp - How to match all words except strict ones?

I'm trying to find a regexp that exclude specific word but not words containing it. For example if we exclude the word "home" home --> NOT OK homefree -> OK freehome -> OK Any ideas ? Thanks
Day
  • 339
  • 2
  • 11
4
votes
2 answers

In codeigniter redirecting is not working without index.php?

I am new to codeigniter while redirecting a page index.php is not loading by default,So i have tried the below code in htaccess file. I have installed php 5.3.10, apache server and postgres database. so if any new configuration have to be done apart…
4
votes
2 answers

CodeIgniter Routing - 404 error

I'm developping a website using CI and today I'm facing a problem in the admin part. I've an admin and I can manage users the structure of my application is: controllers/admin/users.php in users.php I've some functions: index(), view($id), login(),…
user3129131
  • 79
  • 2
  • 8
1
2 3
16 17