Here give this a try and see how it works.
You have an =
between index.php?contact
Try removing that.
If you want to make all your links URL friendly and not just contact
you can do this.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+) index.php?$1&%{QUERY_STRING} [L]
EDIT:
Your array is blank because you're not passing anything to it. I can't see how you check in your index.php
file but you typically pass parameters as item=value
like index.php?page=contact
. You're not giving it an item
using index.php=contact
so your array is blank with the mod_rewrite.
Based on the info I have, if you used the variable as the item
and value
like below
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)$ index.php?$1=$1&%{QUERY_STRING} [L]
Go to http://www.yoursite.com/contact
You'll get this from PHP $_GET
Array ( [contact] => contact )
But if you do this
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)$ index.php?page=$1&%{QUERY_STRING} [L]
Then go to http://www.yoursite.com/contact
Then you'll get this from PHP $_GET
Array ( [page] => contact )
Then you check it like
if($_GET["page"] == "contact"){
//do whatever
}else{
//show homepage
}
There is nothing wrong with the .htaccess rules I can see. It's your PHP setup.