简体   繁体   中英

CodeIgniter Access controller without index.php in url

I want to remove index.php from url while accessing controller.
This is the current working url : http://localhost/jplugins/index.php/home/index/
But it gives error(404 Page Not Found) when i access using url : http://localhost/jplugins/home/index/

Here are the things i tried while searching over stackoverflow :
1. set $config['index_page'] = ""; in config/config.php
2. place .htaccess , I have tried every htaccess file i found in threads.. none work
3. enable rewrite module in xampp
4. set $config['base_url'] = 'http://localhost/jplugins/'; didnt work either
5. Reinstall Xampp. No change
6. change $config['uri_protocol'] = 'AUTO'; . I have tried every method listed in comment but it only gives home/index output no matter what the query is, like http://localhost/jplugins/asdwhadsadasdasdasdadas/asdasda//asdad --> will give same output as http://localhost/jplugins/index.php/home/index/ .
Lastly i sent my whole code to someone who was also using xampp. It worked there perfectly. Using same xampp version 3.2.1( May 7th 2013).
I'm using windows 7 32bit.
What could be the problem here?

Create a .htaccess file in your jplugins directory and add the following code:

RewriteEngine On

RewriteCond $1 !^(index\.php|images|css|js|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM