how to access url without index.php file in codeIgniter -
rewriteengine on rewritebase /path/learn_ci rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ /path/learn_ci/$1 [l]
above .htaccess file how configure it.
this i've been using on of codeigniter projects, , never had issues.
you need adjust rewritebase. starts root of web server /www/your_project changed /your_project/ in htaccess file.
also, make sure have mod_rewrite enabled.
how enable mod_rewrite apache 2.2
codeigniter htaccess , url rewrite issues
in addition, need remove index.php $config['index_page'] = 'index.php' located in config.php in codeigniter installation.
<ifmodule mod_rewrite.c> rewriteengine on rewritebase /your_project/ #removes access system folder users. #additionally allow create system.php controller, #previously not have been possible. #'system' can replaced if have renamed system folder. rewritecond %{request_uri} ^system.* rewriterule ^(.*)$ /index.php?/$1 [l] #when application folder isn't in system folder #this snippet prevents user access application folder #submitted by: fabdrol #rename 'application' applications folder name. rewritecond %{request_uri} ^application.* rewriterule ^(.*)$ /index.php?/$1 [l] #checks see if user attempting access valid file, #such image or css document, if isn't true sends #request index.php rewritecond $1 !^(index\.php|img|font|css|temp|js|robots\.txt|favicon\.ico) rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php?/$1 [l] </ifmodule> <ifmodule !mod_rewrite.c> # if don't have mod_rewrite installed, 404's # can sent index.php, , works normal. # submitted by: elliothaughin errordocument 404 /index.php </ifmodule>
Comments
Post a Comment