I want for my website that my index.php is only available by requesting the foldername. For example i do not like the http://www.domain.com/index.php and also not the http://www.domain.com/index.php?a=b&c=d and want to create rules to forward these urls to:
http://www.domain.com/
and
http://www.domain.com/?a=b&c=d
I have been tried a couple hours now, but i cant get it working. The http://www.domain.com/ request is also being redirected, but that shouldnt happen. My current (linux) .htaccess code:
- Code: Select all
# index.php cannot be opened [L,R=301]
RewriteBase /
# ROOT folder
# without url parameters - working
RewriteCond %{QUERY_STRING} ^$
# some tryout with only the .php extension because i cant get it working
RewriteCond %{REQUEST_URI} ^/index.php$
RewriteCond %{REQUEST_URI} !^/$
RewriteRule ^index\.(php|phps|html|htm|xml)$ http://www.google.nl/?q=index-without-parameters
# with url parameters
RewriteCond %{QUERY_STRING} !^$
# some tryout with only the .php extension because i cant get it working
RewriteCond %{REQUEST_URI} ^/index.php$
RewriteCond %{REQUEST_URI} !^/$
RewriteRule ^index\.(php|phps|html|htm|xml)(.*)$ http://www.google.nl/?q=index-with-parameters
Does anyone have the code for this?