1

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?

6
  • Have you setup the proper allow / deny directives to use .htaccess on your apache virtual host? Commented Jan 3, 2015 at 15:11
  • do you need to set that? the other person tried my code on stock xampp settings. Commented Jan 3, 2015 at 15:13
  • Depends, maybe try comparing the vhost files for both configurations to see if there are any differences so you can eliminate that as the culprit. Commented Jan 3, 2015 at 15:18
  • Does the solution in this question work for you? - stackoverflow.com/questions/15350137/… Commented Jan 3, 2015 at 15:19
  • after adding line RewriteBase /jsplugins . output is still the same. redirected to xampp page with the htaccess from the answer below Commented Jan 3, 2015 at 15:25

1 Answer 1

1

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]
Sign up to request clarification or add additional context in comments.

9 Comments

with your htaccess. when i open localhost/jplugins/home it redirects to localhost/xampp/splash.php
Very weird... And if you run your code with another program, like USB Webserver? The problem can be you're not running the code in the root.
And nothing else is in your .htaccess?
In CodeIgniter, have you set a default controller?
$route['default_controller'] = 'home'; and $route['assets/(:any)'] = 'assets/$1'; in routes.php located in config
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.