Thursday, July 5, 2012

Codeigniter php frameworks: codeigniter URLs part 1

Codeigniter php frameworks will teach you about codeigniter URLs. If you not understand about installing codeigniter, please follow the previous post. The codeigniter URLs feature is designed to be search engine and human friendly. For the example is example.com/news/article/my_article. Firstly is URI Segment, the segment in the URL is following with the Model-View-Controller(MVC). And for the structure  is example.com/class/function/ID. Class is the first segment represents the controller class that should be invoke. Function is the second segment represents the class function, or method, that should be called. And ID is the third, and any additional segment, represents  the ID and any variables that will be passed to the controller.

For the second learn about codeigniter URLs is How to removing the index.php. what is index.php? index.php is the main file to default appear to your URL. The actually codeigniter URL is example.com/index.php/class/function/ID. Codeigniter php frameworks will be show you how to remove it. You can easily remove it by using .htaccess file with some simple rules. Rules bellow is example of such a file, using the negative method in which everything is redirected except the specified items

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

I think enough for the part 1 of codeigniter URLs, we will discuss another feature of codeigniter URLs in the next post of Codeigniter php frameworks.

This post of Codeigniter php frameworks: codeigniter URLs part 1 is references from http://codeigniter.com/user_guide/general/urls.html.

No comments:

Post a Comment