如果没有指定文件或参数,如何强制htaccess到index.php

I want that if the user enters only site url without specifying any file or any parameters like site.com or site.com/ , then they should be redirected to site.com/index.php but if they enter any file like site.com/somefile.php or give any parameters like site.com/?param=val , then htaccess should not do anything with it and let it run.

You can use this rule as your very first rule in DOCUMENT_ROOT/.htaccess file:

RewriteEngine On

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+\s
RewriteRule ^$ /index\.php [R=302,L]

In your .htaccess, just add this line:

DirectoryIndex index.php

This way apache will look for an index.php all requests to yoursite.com & yoursite.com/. There is no need to add any Rewrite condition rule! Plus, certain servers don't allow rewrite conditions.

In wamp, Rewrite is disabled by default.