web config - How do I create a Rewrite Rule in IIS to temporarily conceal all PDF files? -


i've got pdf files sitting out on web server, , time being hide them (i.e. have them return 404s). can accomplished in web.config file rewrite rule?

in apache can this:

rewriterule \.pdf$ - [r=404,l,nc] 

how accomplish same effect iis?

one way achieve using hiddensegments in iis. hiddensegments make urls inaccessible clients. also, iis return http 404 error client , log 404.8 http substatus.

<configuration>    <system.webserver>       <security>          <requestfiltering>             <hiddensegments>                <add segment="pathofpages" />             </hiddensegments>          </requestfiltering>       </security>    </system.webserver> </configuration> 

edit 1: can use requestfiltering deny pdf extension clients. httpstatus sub code 404.7would returned. requests pdf files denied.

from iis.net

in request filtering pane, click file name extensions tab, , click deny file name extension... in actions pane.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -