0

I've changed $config['index_page'] to

$config['index_page'] = ''

and also updated my .htaccess file content to:

RewriteEngine on
RewriteCond $1 !^(index\.php|public|\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1

but I can't access controllers without putting index.php in my url. So what should I do next?

  • Do you run your server on Linux or Windows? – ciruvan Aug 01 '13 at 10:35
  • @cuewizchris, I'm running on windows – ramin omrani Aug 01 '13 at 10:36
  • 1
    You need to ensure that your rewrite engine is running and - perhaps - there is a line in your vhost config that you need to change (from "AllowOverride None" to "AllowOverride All"). I'm not sure how these steps are supposed to be done on Windows, tho. – ciruvan Aug 01 '13 at 10:41
  • .htaccess is not turned on by default on a windows server. Make sure first this is the case. Take a look at this response and article about configuring it: http://stackoverflow.com/questions/14148489/htaccess-file-on-windows-server – bottleboot Aug 01 '13 at 10:44
  • Have a look in this post ..... http://stackoverflow.com/questions/17852585/how-to-call-codeigniter-controller-function-without-url-without-index/17852790#17852790 – Sharif Aug 01 '13 at 11:51

2 Answers2

0

try with following .htaccess, it works fine for me.

# index file can be index.php, home.php, default.php etc.
DirectoryIndex index.php

# Rewrite engine
RewriteEngine On

# condition with escaping special chars
RewriteCond $1 !^(index\.php|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
Janith Chinthana
  • 3,792
  • 2
  • 27
  • 54
0

try this one

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

put this code in your root folder htaccess file and clear your application folder htaccess file's content.

please let me know if you face any problem.

ABorty
  • 2,512
  • 1
  • 13
  • 16