CodeIgniter: Trouble removing "index.php" from URL -
i have been trying fix days , have tried following tutorials:
and many many others.
none have worked.
here problem:
whenever click site link in wamp localhost/ci/index.php/homecontroller works fine.
if omit “index.php” url (localhost/ci/homecontroller), however, shows me same folder list on localhost.
this htaccess file in root:
<ifmodule mod_rewrite.c> rewriteengine on rewritebase /ci/ #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 %{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>
and in config file:
$config['base_url'] = 'http://localhost/ci/'; $config['index_page'] = ''; $config['uri_protocol'] = 'auto';
this still redirected me wamp home page.
i uncommented (in httpd.conf file).
loadmodule rewrite_module modules/mod_rewrite.so
additional information:
in routes.php file:
$route['default_controller'] = "homecontroller";
my abbreviated file structure: (located @ c:\wamp\www)
- /ci
- /application
- /cache
- /config
- /controllers
- /core
- /errors
- /helpers
- /hooks
- /languages
- /libraries
- /logs
- /models
- /third_party
- /views
- .htaccess
- index.html
- /assets
- /system
- .htaccess
- index.php
- /application
any appreciated. sorry if there answers on topic. none have worked project.
edit:
if try htaccess:
rewriteengine on rewritecond $1 !^(index\.php|images|robots\.txt) rewriterule ^(.*)$ /ci/index.php?/$1 [l]
i get:
internal server error server encountered internal error or misconfiguration , unable complete request. please contact server administrator, admin@localhost , inform them of time error occurred, , might have done may have caused error. more information error may available in server error log.
rewriteengine on rewritebase /ci/ rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewritecond $1 !^(index\.php|js|img|css|captcha|robots\.txt) rewriterule ^(.*)$ /ci/index.php/$1 [l]
this default htaccess use projects remove index.php
rewritebase
(/ci/
) , rewriterule
(/ci/index.php
) should reference base directory of project. say, project hosted @ http://www.yoursite.com/ci/?
also, if hosting project on wamp need enable htaccess in config. this, click on wamp icon , choose apache->apache modules->rewrite_module. restart services.
good luck!
Comments
Post a Comment