3

I am trying to remove index.php from url. But its not working!

Using ubuntu 12.04 ( LAMP).

CodeIgniter_2.1.2

.htaccess file

<IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /cms1



        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ index.php/$1 [L] 
    </IfModule>

in config.php :

$config['index_page'] = 'index.php'; to $config['index_page'] = '';

Directory structure:

/var/www/cms1

->cms1
    ->application
    ->system
    ->user_guide
    ->index.php
    ->license.txt
    ->.htaccess

3 Answers 3

5

Got it.
permit changes in the .htaccess file

Sign up to request clarification or add additional context in comments.

Comments

3

Htaccess:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]

And in your applications/config/config.php

$config['base_url'] = 'http://www.yourwebsite.com'; //url to your project
$config['index_page'] = ''; //Needs to be empty

Comments

0

The project root-directory .htaccess file replace with below contains.

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.