Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove index.php in Wamp?

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.

like image 813
gusdewa Avatar asked Aug 13 '13 12:08

gusdewa


People also ask

How do I get rid of index php?

To remove the “index. php” from your site's URLs, you will first need to make sure your server is set up to pass would-be 404 requests off to Craft's index. php file behind the scenes. If you're running Apache, you can do that by creating a redirect in your site's .


2 Answers

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.

like image 167
Manju Avatar answered Jan 04 '23 05:01

Manju


Create an .htaccess file if you didn't already have one and add this code in it:

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

Make sure you place this in the same directory as your index.php.

like image 23
f605dcf7dc5542e93ae9cd76f Avatar answered Jan 04 '23 03:01

f605dcf7dc5542e93ae9cd76f