How come ‘index’ is failing to match this rewrite rule?

Posted on

How come ‘index’ is failing to match this rewrite rule? – Managing your servers can streamline the performance of your team by allowing them to complete complex tasks faster. Plus, it can enable them to detect problems early on before they get out of hand and compromise your business. As a result, the risk of experiencing operational setbacks is drastically lower.

But the only way to make the most of your server management is to perform it correctly. And to help you do so, this article will share nine tips on improving your server management and fix some problem about apache-2.2, .htaccess, mod-rewrite, , .

Here are all of my rewrite rules: (there are no others – this is all of them)

RewriteEngine On
RewriteRule ^$ index.php?action=index
RewriteRule ^([w]+)$ index.php?action=$1

When I visit:

mysite.com/test

The PHP script index.php is indeed invoked and has $_GET['action'] set to test as expected.

However, when I visit:

mysite.com/index

…the PHP script reports that $_GET is empty. Why does this happen only for index?

Solution :

This might have something to do with your DirectoryIndex setting:

http://www.phpfreaks.com/forums/mod_rewrite/mod_rewrite-and-directoryindex/

Leave a Reply

Your email address will not be published.