How to catch all php file requests in asp.net routes

89 views Asked by At

I have built site using asp.net web forms and used routes for friendly urls. I want to catch all php file requests and send them to a page which it will send the response back to the client as 410. below are some of the requests

1) /admin.php

2) /wp-login.php

3) http://easybankifsccode.com/administrator/index.php

4) http://easybankifsccode.com/wp-content/plugins/candidate-application-form/downloadpdffile.php?fileName=../../../../../../../../../../etc/passwd

Right now im catching all these requests in my code by cross checking with DB and redirecting to 404 page but i want to configure my route to catch all these php requests and send to 410 error page so there will be no db checking required

Something like

routes.MapPageRoute("phpfiles", "{resource}.php{anything}", "errors/410.aspx");

How to write this rule?

0

There are 0 answers