Forum Moderators: phranque
i hope i can be clear on what im trying here.
now lets say casino bots are abusing my folders like /files/php/whatever.php file.
Thing is.../files/php/ did excist but not anymore..
Now i can use redirect in the htaccess like Redirect permanent /files/php/ [mysite.com...]
okay that redirects them to my root but if they looked for signup.php so if the request is /files/php/signup.php it redirects to [mysite.com...] whitch isnt what i want.
So how do i redirect EVERY php or html request on whatever page after /files/php/ to my root?
i tried :
rewriterule ^files/php -
and
RewriteRule /files/php [mysite.com...] [r=302,nc,l]
It does work but still goes to [mysite.com...]
Anyone?
RewriteRule ^files/php/.+(php¦html)$ / [R=302,NC,L]
For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].
Jim
The only thing I can think of is that it is conflciting with another Rewriterule, a script based redirection (if you tried that at some point) or I'm just wrong!
Andrew
[edited by: jdMorgan at 3:27 am (utc) on Feb. 12, 2006]
[edit reason] Careful with wording, please. [/edit]
Note that in a per-directory (.htaccess) context, the path to the current directory where the .htaccess code is installed will be stripped. This means that the path to the local directory, including the leading slash, will be removed from the URL-path examined by RewriteRule in .htaccess.
Jim
the login.php is just an example....
lets say a casino bot or whatever goes into the directory /files/php/
and looks for the file contact.php or signup.php or register.php or even config.php.....thats just a file it looks for to abuse it.
its the same as guestbooks,they are also vunerable,cause the file to sign is most likely sign.php and for chatscripts its likely chat.php
Okay lets move on.....i had the directory /files/php/
but not anymore.
but if it was a chat directory they were looking for ...then they would use chat.php...understand?
So in order to stop this it means the rewrite has to be a catch all,same as mail to your website domain.
meaning that every php or html file requested after /files/php/....from here.... must be blocked and redirected to the main domain again.
And with the latest posted rewrite i get the same results...i pretend to visit www.mysite.com/files/php/webmaster.php (note:i just use webmaster.php as sample)....
rerwrite works but sends me to www.mysite.com/webmaster.php
Well i cant be clearer then this...
You might want to use a server headers checker to 'follow' the path that such a request takes; There may be multiple rewrites or redirects involved, and that's one way to find them.
BTW, since I forgot my manners... Welcome to WebmasterWorld!
Jim
Well thanks for the replies so far but you guys know 1000x more about this then i do....lol
You know how those bots work..
Point is ...they are looking for files to abuse simple as that.
Thing is...with a litle luck the file they request realy excist..
For example....every php running website maybe has a page called login.php , or has a includes folder so they try config.php or config-inc.php whatever..
So lets say i have www.site.com/files/php/
And whatever bot .. requests www.site.com/files/php/signup.php
why does the redirect or rewrite goes to www.site.com/signup.php? and not to www.site.com like i want?