2

My login Controller : $this->load->view('login-view');

My link that redirects to 'login-view' is in the template is: anchor('login','Login');

Before removing index.php from url in codeigniter works well. But after removing index.php from url it is not working.

My .htaccess file is :

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

hard to expalin i think, Thats all i have got. :(

7
  • And it still works if you call it like index.php/login? Commented Dec 25, 2012 at 9:10
  • Have you set up config.php and routes.php? Commented Dec 25, 2012 at 9:17
  • index.php/login works... but index.php is showing in the url... Commented Dec 25, 2012 at 9:28
  • sry not to mention... I'm working in wamp, offline Commented Dec 25, 2012 at 9:34
  • i have set up my config.php like $config['uri_protocol']= 'REQUEST_URI'; and $route['default_controller'] = "home"; Commented Dec 25, 2012 at 9:35

2 Answers 2

2

Try this in .htaccess

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

And in config.php

$config['uri_protocol'] = 'AUTO';
Sign up to request clarification or add additional context in comments.

2 Comments

not working... :( anchor('index.php/login','Login') is working but url contains (site)/index.php/login
Oops! success! i placed my htaccess file in the application folder before, now it is in my root directory... Thank u all for suggestions
0

Just remove index.php from your config file.

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

should be

$config['index_page'] = ""; 

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.