Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.02 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <configuration>
  3. <system.webServer>
  4.  
  5. <!-- Prevent web access to all files in the /config/ directory -->
  6. <security>
  7. <requestFiltering>
  8. <hiddenSegments>
  9. <add segment="config"/>
  10. </hiddenSegments>
  11. </requestFiltering>
  12. </security>
  13.  
  14. <!-- Add mime types for a few additional files -->
  15. <staticContent>
  16. <mimeMap fileExtension=".json" mimeType="application/json" />
  17. <mimeMap fileExtension=".mp4" mimeType="video/mp4 " />
  18. </staticContent>
  19.  
  20. <!-- X3 rewrite rules -->
  21. <rewrite>
  22. <rules>
  23.  
  24. <!-- Prevent access to various PHP with exceptions -->
  25. <rule name="Prevent access to various PHP with exceptions">
  26. <match url="^(app|templates|extensions)/" />
  27. <conditions>
  28. <add input="{REQUEST_FILENAME}" pattern="\.php$" ignoreCase="false" />
  29. <add input="{REQUEST_FILENAME}" pattern="(/app/parsers/slir/|x3.mailer.php|x3.api.php)" ignoreCase="false" negate="true" />
  30. </conditions>
  31. <action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
  32. </rule>
  33.  
  34. <!-- Rewrite any calls to *.html, *.json, *.xml, *.atom or *.rss if a folder matching * exists -->
  35. <rule name="Rewrite any calls to *.html, *.json, *.xml, *.atom or *.rss if a folder matching * exists" stopProcessing="false">
  36. <match url="(.+)\.(html|json|xml|atom|rss)$" ignoreCase="false" />
  37. <conditions logicalGrouping="MatchAll">
  38. <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
  39. <add input="{URL}" pattern="public/" ignoreCase="false" negate="true" />
  40. <add input="{DOCUMENT_ROOT}/public/{R:1}.{R:2}" matchType="IsFile" negate="true" />
  41. </conditions>
  42. <action type="Rewrite" url="{R:1}/" />
  43. </rule>
  44.  
  45. <!-- Add a trailing slash to directories -->
  46. <rule name="Add a trailing slash to directories" stopProcessing="false">
  47. <match url="([^/]+)$" ignoreCase="false" />
  48. <conditions logicalGrouping="MatchAll">
  49. <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
  50. <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
  51. <add input="{URL}" pattern="(\.|\?)" ignoreCase="false" negate="true" />
  52. <add input="{URL}" pattern="(.*)/$" ignoreCase="false" negate="true" />
  53. </conditions>
  54. <action type="Rewrite" url="{R:1}/" />
  55. </rule>
  56.  
  57. <!-- Rewrite any calls to /render to the image parser -->
  58. <rule name="Rewrite any calls to /render to the image parser" stopProcessing="false">
  59. <match url="^render/." ignoreCase="false" />
  60. <conditions logicalGrouping="MatchAll">
  61. <add input="{URL}" pattern="render/" ignoreCase="false" />
  62. </conditions>
  63. <action type="Rewrite" url="app/parsers/slir/" />
  64. </rule>
  65.  
  66. <!-- Rewrite routes to index.php if they are non-existent files/dirs -->
  67. <rule name="Rewrite routes to index.php if they are non-existent files/dirs" stopProcessing="false">
  68. <match url="^(.*)/$" ignoreCase="false" />
  69. <conditions logicalGrouping="MatchAll">
  70. <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
  71. <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
  72. </conditions>
  73. <action type="Rewrite" url="index.php?/{R:1}/" appendQueryString="true" />
  74. </rule>
  75.  
  76. <!-- Rewrite any file calls to the public directory -->
  77. <rule name="Rewrite any file calls to the public directory" stopProcessing="false">
  78. <match url="^(.+)$" ignoreCase="false" />
  79. <conditions logicalGrouping="MatchAll">
  80. <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
  81. <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
  82. <add input="{URL}" pattern="public/" ignoreCase="false" negate="true" />
  83. </conditions>
  84. <action type="Rewrite" url="public/{R:1}" />
  85. </rule>
  86.  
  87. </rules>
  88. </rewrite>
  89. </system.webServer>
  90. </configuration>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement