Forum Moderators: phranque

Message Too Old, No Replies

Redirect only index.php to TLD without question mark

         

hanszucker

9:54 pm on Nov 24, 2011 (gmt 0)

10+ Year Member



I need to redirect an url like mydomain.com/index.php to mydomain.com/

This sounds easy but the software framework also uses urls like mydomain.com/index.php? Those urls (with an single-added question mark) should not redirect to mydomain.com.

The problem cannot be solved whith using

RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)$ /? [L,R=301]


as this replaces/search for complete query strings such like foo=bar but not a single question mark.

How can I manage to redirect ONLY the pure index.php (index.php with a single added question mark should not redirect)?
I hope somone can help me out as I am an absolutely newbie with mod_rewrite and regular expressions.