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
1
vote
2 answers

New pages in CodeIgniter on a big website

I have a website with many scripts written in "pure" PHP, i.e. no specific framework has been used to write the files. Furthermore, all the URLs are custom using .htaccess and specific PHP scripts. For a smooth transition, I would like to start…
Johan
  • 110
  • 1
  • 6
1
vote
2 answers

How would I generate / parse this RESTful url in codeigniter

I'm new to MVC, being RESTful, and CodeIgniter. I'm trying to get into them in my spare time, so this is largely an academic question. I'm trying to build a URL that will display the availability of a particular hotel room, for a particular hotel. …
Allen Rice
  • 19,068
  • 14
  • 83
  • 115
1
vote
2 answers

Codeigniter URL routing question

I'd like to know how to accomplish the following using the Codigniter MVC framework: I want the URLs on my site looking like…
thwd
  • 23,956
  • 8
  • 74
  • 108
1
vote
1 answer

CodeIgniter - Turn off controller function call?

I simply want to load the controller and not call a function based on the URI, so that I can then generate the page based on the following segments. How do I change the default behaviour to do this? eg. example.com/class/function/ID >>>…
davivid
  • 5,910
  • 11
  • 42
  • 71
1
vote
1 answer

Empty parameters in codeigniter url

I have a controller which takes 4 parameters. Sometimes parameters can be empty. Standard url is like review/fetch_reviews/10/uk/topcomments/1234 where 10 represents count for paging.If that parameter is blank then url becomes…
www.amitpatil.me
  • 3,001
  • 5
  • 43
  • 61
1
vote
1 answer

Can CodeIgniter route to different controllers based on port number?

I would like to have CodeIgniter route to a different controller based on port number like so: host_name/ControllerName => foo() host_name:3000/ControllerName => bar() I've added port 3000 to Apache's httpd.conf, so the server listens to…
Eugene
  • 319
  • 2
  • 13
1
vote
1 answer

Multiple apps Codeigniter: remove "index.php/controller" from URL

I am new to CodeIgniter and trying to understand the basics and maybe some advance methods to set an MVC based application. After a while I thought i might get a try to set a admin panel as well and created and second folder as admin…
Dinca Adrian
  • 1,190
  • 11
  • 21
1
vote
2 answers

Redirect loop in Codeigniter with single redirect from base controller

I have this base controller: class TCMS_Controller extends CI_Controller{ public function __construct(){ parent::__construct(); if( ! $this->session->userdata('logged_in')){ redirect('admin/authenticate/login'); …
Tachi
  • 2,042
  • 3
  • 27
  • 44
1
vote
5 answers

CodeIgniter - Routing urls with GET Variables

I checked the similar questions out there, but those doesnt seem to help. I have an email verification like, that is to be routed in CodeIgniter to the right function with data passed to the function for further processing. Sample URL…
Kishor
  • 1,513
  • 2
  • 15
  • 25
1
vote
0 answers

Codeigniter 2 - internationalization without segment in the URL

I have created a new portal in 5 language using the library: internationalization i18n https://github.com/bcit-ci/CodeIgniter/wiki/CodeIgniter-2.1-internationalization-i18n Works fine, but the in the url there is ever the language segment (en, fr,…
1
vote
1 answer

Codeigniter ci_sessions table storing ip address as 0.0.0.0 why? even when hosted I am getting 0.0.0.0

Hello in my codeigniter I have created table as ci_sessions with following fields CREATE TABLE IF NOT EXISTS `ci_sessions` ( session_id varchar(40) DEFAULT '0' NOT NULL, ip_address varchar(45) DEFAULT '0' NOT NULL, user_agent…
1
vote
2 answers

Upload and Resize in CodeIgniter

I am uploading and re-sizing multiple images, but this code work good for 1 file if i upload 2 or more file it will re-size 1st pic as complete black and all other pics uploaded unchanged. function do_upload() { $files =…
Farrukh Javed
  • 39
  • 2
  • 7
1
vote
2 answers

codeigniter routing and redirecting

When I type in my base url http://localhost/myproject/admin it keeps on sending me to my permissions page. The http://localhost/myproject/admin is the base_url(). My core/Controller.php how it works is that it checks if can access the controllers…
user4419336
1
vote
4 answers

How to redirect every uri calls to one controller, except some static ones?

I'm using codeigniter and want to make my portal a bit more SEO friendly. I have a controller (articles) which handles every article on my portal. The URL looks like this: example.com/articles/category-sub-category/article-name I'm using mod…
therufa
  • 2,050
  • 2
  • 25
  • 39
1
vote
2 answers

URL Duplicating in CodeIgniter Like http://localhost/CI/login/login/login

Am working on a codeigniter application. I have a login.php with the following code public function index() { $this->load->view('login'); } public function login() { $username=$this->input->post('username'); …