amol challawar
amol challawar

Reputation: 1434

.htaccess problme in codeigniter for removing index.php from url

I have .htaccess file in my root directory:

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

If i use
http://iemedica.com.ph/index.php/aboutUs it will working for me
but if i use
http://iemedica.com.ph/aboutUs its give me 404 Error

Upvotes: 0

Views: 56

Answers (4)

Arun Yokesh
Arun Yokesh

Reputation: 1354

Enable your Rewrite module in Apache server and use this HTA Access

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

copy and paste this code and save the file in the name of .htaccess under your codeigniter directory.

Upvotes: 0

Raham
Raham

Reputation: 4951

First of all you do the following changes in application->config->config.php

             $config['base_url'] = "";
             $config['index_page'] = "";

While in .htaccess write the following code.

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

This will work.

Upvotes: 0

Rana Soyab
Rana Soyab

Reputation: 896

Try This :)

<IfModule mod_rewrite.c>
    RewriteEngine On
    #RewriteBase /

    RewriteCond %{REQUEST_URI} ^system.*
   RewriteRule ^(.*)$ /index.php?/$1 [L]

    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

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

Upvotes: 0

anubhava
anubhava

Reputation: 784928

Change your .htaccess to ths:

RewriteEngine On
RewriteBase /

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

Also in DocumentRoot/application/config/config.php you need to have these config settings:

$config['base_url']     = '';
$config['index_page']   = '';
$config['uri_protocol'] = 'AUTO';

Upvotes: 1

Related Questions