For my application, I wish to match an URL with mod_rewrite so that the URL is passed straight to the file (index.php) via a GET request. This really is my code:

RewriteEngine On
RewriteRule ^(.*)$ index.php?q=$1

However, it isn't working, also it seems to indeterminately rewrite it as being "index.php?q=index.php". Could anybody enlighten me about this problem? Thanks.

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?q=$1 [L]

try that one example