InterviewSolution
| 1. |
Default URL pattern and how to make changes in the same. |
|
Answer» The default URL structure for CodeIgniter is SEO and human-friendly. Codeignitor uses SEGMENT based approach over to query string. knowledgehut.com/interview-questions/codeignitor The SEGMENTS in the URL with the Model-View-CONTROLLER approach, usually represent: knowledgehut.com/class/function/ID. Here Class which is our first segment REPRESENTS controller class. Function Our 2nd segment represents which function or method of the controller to be called. ID Our 3rd segment represent that any additional ID or Parameter to be pass to the controller. To access the URL pattern we need to use URI Library or URL Helpers available in codeignitor. By Default, Index.php is part of your URLs. Like knowledgehut.com/index.php/interview-questions/codeignitor To remove index.php, if your apache has mod-rewrite enabled then modify the .htaccess file with SIMPLE rules. RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] |
|