Preventing DIRECT access to files
Posted: Wed Sep 19, 2007 8:45 am
I am using mod rewrite rules for redirecting. An example of the rule is as below
Now someone who knows that there exists a folder dir can write
example.com/dir/index.php access the file although it requires sid, catid, page and alphabet as a must. I want to prohibit this.
writing example.com/dir/index.php should give a notice "wrong url come thru proper redirection" but example.com/1/1/1/ should redirect to correct path without any errors. How to do this??
Code: Select all
RewriteRule ^/?(1)/([0-9]+)/([0-9]+)/([a-zA-Z])$ dir/index.php?sid=$1&catid=$2&page=$3&alphabet=$4example.com/dir/index.php access the file although it requires sid, catid, page and alphabet as a must. I want to prohibit this.
writing example.com/dir/index.php should give a notice "wrong url come thru proper redirection" but example.com/1/1/1/ should redirect to correct path without any errors. How to do this??