0

I'm trying to remove index.php,in my localhost, but it seems doesn't working,its on http://localhost/testing.

I put .htacces in 'testing' directory under the htdocs.

LoadModule rewrite_module modules/mod_rewrite.so at Apache/conf also already unchecked.

Here my .htaccess:

RewriteEngine On
RewriteBase /testing/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /testing/index.php/$1 [L]

Here my config:

$config['base_url']    = "http://localhost/testing";
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';

When I access login controller, it's not found.

Not Found

The requested URL /testing/login was not found on this server.

I really don't know what to try next. Any help would be appreciated.

1
  • is there any others settings ? Commented Oct 19, 2013 at 10:50

6 Answers 6

1

Try this :-

Config.php :-

$config['base_url'] = 'http://localhost/testing/';

$config['index_page'] = '';

.htaccess

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
Sign up to request clarification or add additional context in comments.

Comments

0

Your htaccess should be like

RewriteEngine On
RewriteBase /testing/

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

There's no need to append /testing/ since RewriteBase already takes care of that.

1 Comment

Is mod_rewrite enabled? Change the flags to [R,L] to see if browser gets redirected.
0

basically the index.php is included in all URLs:

we can remove this using .htaccess with a simple rules. following is an example of such a file, using the "negative" method in which everything is redirected,

   RewriteEngine on
   RewriteBase /testing/
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ /index.php/$1 [L]

now restart your server and check

Comments

0

Leave out the trailing slash in RewriteBase:

RewriteEngine On
RewriteBase /testing

RewriteCond $1 !^(index\.php|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]

$config['base_url'] should be http://localhost/testing/

$config['index_page'] should be blank.

Comments

0

Try this one in the .htaccess file:

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

your config file is fine

Difference being the "?" after index.php

Comments

0

You may also want to try changing the value of $config[‘uri_protocol’] in ./application/config/config.php. Sometimes CodeIgniter gets it wrong. Changing it to PATH_INFOmight work.

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.