Thursday, 15 July 2010

apache - CodeIgniter removing index.php not working -



apache - CodeIgniter removing index.php not working -

i'm using ubuntu 13 next setup local codeigniter site.

apache/2.4.6 (ubuntu) 5.5.3-1ubuntu2.2 'ci_version', '2.1.2'

and urls no longer working without index.php. used work, after upgrading ubuntu 12.x 13.x , few apache updates on past year, localhost sites no longer work right.

if go localhost/index.php/controllername/ works if go localhost/controllername/ not.

mod_rewrite enabled.

codeigniter config has:

$config['index_page'] = ''; $config['uri_protocol'] = 'auto'; // tried available options here ,

nothing worked

in .conf file domain have this:

<directory /> options -multiviews +followsymlinks allowoverride </directory>

and here's .htaccess file commented lines ones tried didn't work.

<ifmodule mod_rewrite.c> rewriteengine on rewritebase / # rewritecond $1 !^(index\.php|robots\.txt) rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php?/$1 [l] # rewriterule .* index.php/$0 [pt,l] # rewriterule ^(.*)$ index.php/$1 [l,qsa] </ifmodule> <ifmodule !mod_rewrite.c> errordocument 404 /index.php </ifmodule>

i’ve googled , read can find , tried find including several posts here on stack overflow, including ones in “questions may have answer.” still nil seemed work. said, worked in past, after multiple updates os , apache did first notice stop working.

i’ll moving away codeigniter future projects, these projects existed. baffled issue.

solution:

turns out not codeigniter issue @ all. apache issue not rewrite rules. in apache2.conf had alter block /var/www/

require granted seems have done trick.

directoryindex index.php index.html options indexes followsymlinks allowoverride require granted

just measure, made alter here well: options followsymlinks allowoverride require granted

found on askubuntu http://askubuntu.com/questions/421233/enabling-htaccess-file-to-rewrite-path-not-working

copy next code .htaccess in root folder

rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule .* index.php/$0 [pt,l] options -indexes

this works fine me remove index.php in codeigniter.

php apache .htaccess codeigniter mod-rewrite

No comments:

Post a Comment