Prevent to access to page by index.php
开发者_Go百科I use clean URLs in my site and I want to prevent access to my page when a user write index.php in URL! I also have index.php
in my form that has POST method!
Is there any way I can use something like this:
RewriteCond %{REQUEST_METHOD} = GET [AND] %{SCRIPT_FILENAME} = index.php
Redirect 301 / http://example.com/
Is this code correct ?
EDIT
I use this but it seems it fall in infinity loop !
RewriteCond %{REQUEST_METHOD} ^GET$
RewriteCond %{SCRIPT_FILENAME} ^index.php
Redirect 301 / http://www.XXXXXXXXX.net/
This should work:
RewriteCond %{REQUEST_METHOD} ^GET$
RewriteCond %{SCRIPT_FILENAME} ^index\.php
RewriteRule ^(.*)$ http://XXXXX.COM/ [R=301]
精彩评论