Tuesday, July 14, 2009

Removing index.php from the url in codeigniter

Hi,

I also tried to find out many the exact way to remove the index.php from the url but did not get much help. Then after lots of hits and try I made the .htacess that is working for me. So I wanted to share this with you all.
My framework is in the folder abc.

The .htaccess

RewriteEngine on
RewriteCond %{QUERY_STRING} ^(ACT=.*)$ [NC]
RewriteRule ^(.*)$ index.php?%1 [L]
RewriteCond $1 !^(images|_css|_js|scripts|cal|uploads|portal_member_image|index.php) [NC]
RewriteRule ^(.*) /abc/index.php?/$1 [L]

And when ever you make a call to a controller please specify the full url without the index.php like if I want to call a controller called hi controller and inside that a hello function then what i will have to write is.

redirect($this->config->item('baseurl').'hi/hello');

Hope this will of any help to someone.

Thanks
Jawed

No comments:

Post a Comment