I'm having the following issue: I have this url www.mysite.com/inde.php?SomePageName and I want to rewrite it to www.mysite.com/SomePageName also, I want to get rid of index.php when the url is called without any params eg: mysite.com/index.php or mysite.com/index.php? should redirect to mysite.com/
My htaccess file looks like this:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(index\.php)?\?([^&\ ]+)
RewriteRule ^ /%2? [L,R=302]
RewriteRule ^index.php$ http://www.mysite.com/ [R=302,L]
Now it's doing a loop because of the last declaration.
Is there any way that I can achieve this ?
Thanks
PS: the whole htaccess
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^cumpara-(.*)-(.*)\.html$ index.php?Profile&ID=$2 [L]
RewriteRule ^lista-scut-motor-metalic-(.*)-(.*)-(.*)\.html$ index.php?List&SubID=$3&Categorie=$1&Subcategorie=$2 [L]
RewriteRule ^scut-motor-metalic-(.*)-(.*)\.html$ index.php?ViewCat&CatID=$2 [L]
RewriteRule ^foto-(.*)-(.*).jpg$ includes/timthumb.php?src=data/$1/$2.jpg&w=300&q=100 [L]
RewriteRule ^product-(.*)-(.*).jpg$ includes/timthumb.php?src=data/$1/$2.jpg&w=530&q=100 [L]
RewriteRule ^side-(.*)-(.*).jpg$ includes/timthumb.php?src=data/$1/$2.jpg&w=175&h=110&q=100 [L]
RewriteRule ^zoom-(.*)-(.*).jpg$ data/$1/$2.jpg [L]
RewriteCond %{REQUEST_URI} ^/index.php$
RewriteCond %{QUERY_STRING} !^$
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^.*$ http://www.mysite.com/%1/? [R=302,L]
RewriteRule Despre index.php?Despre [L]
RewriteRule Help index.php?Help [L]
RewriteRule Livrare index.php?Livrare [L]
RewriteRule Contact index.php?Contact [L]
RewriteCond %{HTTP_HOST} ^mysite.com$
RewriteRule ^(.*)$ "http\:\/\/www\.mysite\.com\/$1" [R=301,L]
ErrorDocument 404 /404.html