How to remove index.php in Wamp?

codeigniter, wamp

Solution

Please try the following:

1) Create .htaccess file in parallel to application folder and just copy paste the following code:

RewriteEngine On
RewriteBase /CodeIgniter/
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

2) Change `$config['index_page']` to blank in `config.php` in application folder as below:

$config['index_page'] = '';

3) Enable "`rewrite_module`" of apache. Click on WAMP symbol -> Apache -> Apache modules -> rewrite_module

Now you can access your site without index.php in url.

Problem

I 've been using CodeIgniter in XAMPP. There was no problem to redirect to a function URL (e.g., function1): ``` http://localhost/function1 ``` When I changed to WAMP, I got a problem. I could not redirect to function1. However, function1 is still accessed at: ``` http://localhost/index.php/function1 ``` How to configure WAMP and CodeIgniter to remove index.php? In order that I could run function1 as I run using XAMPP. Thank you.

Original source