Posts

Showing posts from January, 2015

How to Remove index.php From Codeigniter Website's URL

Here is the step by step process of removing index.php factor from your Codeigniter website or web application. 1. Navigate to your   config file through   Application=>config=>config.php   and change following lines:- $config['base_url'] = 'http://example.com/'; $config['index_page'] = ''; 2. Now create a  .htaccess file on root directory of your website or web application.   <IfModule mod_rewrite.c>         RewriteEngine On         RewriteBase /         # Removes index.php from ExpressionEngine URLs         RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]         RewriteCond %{REQUEST_URI} !/system/.* [NC]         RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]         # Directs all EE web requests through the site index file         RewriteCond %{REQUEST_FILENAME} !-f         RewriteCond %{REQUEST_FILENAME} !-d         RewriteRule ^(.*)$ Your Folder Name /index.php/$1 [L] </IfModule> Copy above code and

Link Css File in Codeigniter

Here is following way to add css in your view file..... First Method-:  put your css file in your folder at root directory     go ot view file and add following code in head section. <link rel="stylesheet" type="text/css" href="<?php echo base_url("foldername/style.css");?>" /> Second Method-: put this code in your before starting of html code in your view file     <?php $this->load->helper('html');?> after this add following code in your head section  <?php echo link_tag(base_url().'style/style.css') ;?> Note:if you do not want to write this code <?php $this->load->helper('html');?> in your view file, Go to Application->Config->autoload.php and change following codes before $autoload['helper'] = array(); replace $autoload['helper'] = array("url","html"); Thanks