Infolinks In Text Ads

Showing posts with label CODEIGNITER. Show all posts
Showing posts with label CODEIGNITER. Show all posts

Wednesday, 15 July 2015

Remove index.php from Codeigniter


Method 1 for working in local system


step 1 : Open your text editor  commonly notepad++ or sublime 

step 2 : paste any one of the below code in that file.


Code 1 >>

<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 ^(.*)$ /index.php/$1 [L]
</IfModule>


Code 2 >>

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA] 

step 3 : save it inside codeigniter root folder or www directory.


Note :
Remove the value of index_page in config.php file inside config folder.

$config['index_page'] = '';

In somecase the default setting for uri protocol does not work properly.
So just comment the original code and make it as like below code in config.php inside config folder.

//$config['uri_protocol'] = 'REQUEST_URI';
$config['uri_protocol'] = 'AUTO';


Method 2 for making changes in online directly

Step 1 : create .htaccess file using your FTP client iin the root folder of the project that is index.php file location.

step 2 : Paste any one code from above into that and make other changes.

For more detailed explanation visit codeigniter user guide link provided below


Thank you 

Follow me on Facebook