permanaj

Untitled

Dec 11th, 2024
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.73 KB | None | 0 0
  1. #
  2. # Apache/PHP/Drupal settings:
  3. #
  4.  
  5. # Protect files and directories from prying eyes.
  6. <FilesMatch "\.(engine|inc|install|make|module|profile|po|sh|.*sql|theme|twig|tpl(\.php)?|xtmpl|yml)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\.(?!well-known).*|Entries.*|Repository|Root|Tag|Template|composer\.(json|lock)|web\.config|yarn\.lock|package\.json)$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig|\.save)$">
  7. <IfModule mod_authz_core.c>
  8. Require all denied
  9. </IfModule>
  10. <IfModule !mod_authz_core.c>
  11. Order allow,deny
  12. </IfModule>
  13. </FilesMatch>
  14.  
  15. # Don't show directory listings for URLs which map to a directory.
  16. Options -Indexes
  17.  
  18. # Set the default handler.
  19. DirectoryIndex index.php index.html index.htm
  20.  
  21. # Add correct encoding for SVGZ.
  22. AddType image/svg+xml svg svgz
  23. AddEncoding gzip svgz
  24.  
  25. # Most of the following PHP settings cannot be changed at runtime. See
  26. # sites/default/default.settings.php and
  27. # Drupal\Core\DrupalKernel::bootEnvironment() for settings that can be
  28. # changed at runtime.
  29. <IfModule mod_php.c>
  30. php_value assert.active 0
  31. </IfModule>
  32.  
  33. # Requires mod_expires to be enabled.
  34. <IfModule mod_expires.c>
  35. # Enable expirations.
  36. ExpiresActive On
  37.  
  38. # Cache all files for 1 year after access.
  39. ExpiresDefault "access plus 1 year"
  40.  
  41. <FilesMatch \.php$>
  42. # Do not allow PHP scripts to be cached unless they explicitly send cache
  43. # headers themselves. Otherwise all scripts would have to overwrite the
  44. # headers set by mod_expires if they want another caching behavior. This may
  45. # fail if an error occurs early in the bootstrap process, and it may cause
  46. # problems if a non-Drupal PHP file is installed in a subdirectory.
  47. ExpiresActive Off
  48. </FilesMatch>
  49. </IfModule>
  50.  
  51. # Set a fallback resource if mod_rewrite is not enabled. This allows Drupal to
  52. # work without clean URLs. This requires Apache version >= 2.2.16. If Drupal is
  53. # not accessed by the top level URL (i.e.: http://example.com/drupal/ instead of
  54. # http://example.com/), the path to index.php will need to be adjusted.
  55. <IfModule !mod_rewrite.c>
  56. FallbackResource /index.php
  57. </IfModule>
  58.  
  59. # Various rewrite rules.
  60. <IfModule mod_rewrite.c>
  61. RewriteEngine on
  62.  
  63. RewriteCond %{HTTPS} off
  64. RewriteCond %{HTTP:X-Forwarded-Proto} !https
  65. RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  66.  
  67. # Redirect old domain to new one
  68. # RewriteCond %{HTTP_HOST} ^www.wsaco.com.au$ [NC,OR]
  69. # RewriteCond %{HTTP_HOST} ^wsaco.com.au$ [NC,OR]
  70. # RewriteCond %{HTTP_HOST} ^www.westernsydney.com.au$ [NC,OR]
  71. # RewriteCond %{HTTP_HOST} ^wsa.lndo.site$ [NC,OR]
  72. # RewriteCond %{HTTP_HOST} ^westernsydney.com.au$ [NC]
  73. # RewriteRule ^/?(.*) https://wsiairport.com.au/$1 [L,R=301,NE]
  74.  
  75. # Redirect old domains to new one
  76. RewriteCond %{HTTP_HOST} ^(www\.)?wsaco\.com\.au$ [NC,OR]
  77. RewriteCond %{HTTP_HOST} ^wsa.lndo.site$ [NC,OR]
  78. RewriteCond %{HTTP_HOST} ^wsa\.lndo\.site$ [NC,OR]
  79. RewriteCond %{HTTP_HOST} ^(www\.)?westernsydney\.com\.au$ [NC]
  80. RewriteRule ^(.*)$ https://wsiairport.com/$1 [R=301,L]
  81.  
  82. # Redirect to from wsaco.com.au to westernsydney.com.au
  83. # RewriteCond %{HTTP_HOST} ^wsaco.com.au$ [OR]
  84. # RewriteCond %{HTTP_HOST} ^www.wsaco.com.au$
  85. # RewriteRule ^(.*)$ https://westernsydney.com.au/$1 [L,R=301]
  86.  
  87. # Set "protossl" to "s" if we were accessed via https://. This is used later
  88. # if you enable "www." stripping or enforcement, in order to ensure that
  89. # you don't bounce between http and https.
  90. RewriteRule ^ - [E=protossl]
  91. RewriteCond %{HTTPS} on
  92. RewriteRule ^ - [E=protossl:s]
  93.  
  94. # Make sure Authorization HTTP header is available to PHP
  95. # even when running as CGI or FastCGI.
  96. RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  97.  
  98. # Block access to "hidden" directories whose names begin with a period. This
  99. # includes directories used by version control systems such as Subversion or
  100. # Git to store control files. Files whose names begin with a period, as well
  101. # as the control files used by CVS, are protected by the FilesMatch directive
  102. # above.
  103. #
  104. # NOTE: This only works when mod_rewrite is loaded. Without mod_rewrite, it is
  105. # not possible to block access to entire directories from .htaccess because
  106. # <DirectoryMatch> is not allowed here.
  107. #
  108. # If you do not have mod_rewrite installed, you should remove these
  109. # directories from your webroot or otherwise protect them from being
  110. # downloaded.
  111. RewriteRule "/\.|^\.(?!well-known/)" - [F]
  112.  
  113. # If your site can be accessed both with and without the 'www.' prefix, you
  114. # can use one of the following settings to redirect users to your preferred
  115. # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
  116. #
  117. # To redirect all users to access the site WITH the 'www.' prefix,
  118. # (http://example.com/foo will be redirected to http://www.example.com/foo)
  119. # uncomment the following:
  120. # RewriteCond %{HTTP_HOST} .
  121. # RewriteCond %{HTTP_HOST} !^www\. [NC]
  122. # RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  123. #
  124. # To redirect all users to access the site WITHOUT the 'www.' prefix,
  125. # (http://www.example.com/foo will be redirected to http://example.com/foo)
  126. # uncomment the following:
  127. RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
  128. RewriteRule ^ http%{ENV:protossl}://%1%{REQUEST_URI} [L,R=301]
  129.  
  130. # Modify the RewriteBase if you are using Drupal in a subdirectory or in a
  131. # VirtualDocumentRoot and the rewrite rules are not working properly.
  132. # For example if your site is at http://example.com/drupal uncomment and
  133. # modify the following line:
  134. # RewriteBase /drupal
  135. #
  136. # If your site is running in a VirtualDocumentRoot at http://example.com/,
  137. # uncomment the following line:
  138. # RewriteBase /
  139.  
  140. # Redirect common PHP files to their new locations.
  141. RewriteCond %{REQUEST_URI} ^(.*)?/(install\.php) [OR]
  142. RewriteCond %{REQUEST_URI} ^(.*)?/(rebuild\.php)
  143. RewriteCond %{REQUEST_URI} !core
  144. RewriteRule ^ %1/core/%2 [L,QSA,R=301]
  145.  
  146. # Rewrite install.php during installation to see if mod_rewrite is working
  147. RewriteRule ^core/install\.php core/install.php?rewrite=ok [QSA,L]
  148.  
  149. # Pass all requests not referring directly to files in the filesystem to
  150. # index.php.
  151. RewriteCond %{REQUEST_FILENAME} !-f
  152. RewriteCond %{REQUEST_FILENAME} !-d
  153. RewriteCond %{REQUEST_URI} !=/favicon.ico
  154. RewriteRule ^ index.php [L]
  155.  
  156. # For security reasons, deny access to other PHP files on public sites.
  157. # Note: The following URI conditions are not anchored at the start (^),
  158. # because Drupal may be located in a subdirectory. To further improve
  159. # security, you can replace '!/' with '!^/'.
  160. # Allow access to PHP files in /core (like authorize.php or install.php):
  161. RewriteCond %{REQUEST_URI} !/core/[^/]*\.php$
  162. # Allow access to test-specific PHP files:
  163. RewriteCond %{REQUEST_URI} !/core/modules/system/tests/https?\.php
  164. # Allow access to Statistics module's custom front controller.
  165. # Copy and adapt this rule to directly execute PHP files in contributed or
  166. # custom modules or to run another PHP application in the same directory.
  167. RewriteCond %{REQUEST_URI} !/core/modules/statistics/statistics\.php$
  168. # Deny access to any other PHP files that do not match the rules above.
  169. # Specifically, disallow autoload.php from being served directly.
  170. RewriteRule "^(.+/.*|autoload)\.php($|/)" - [F]
  171.  
  172. # Rules to correctly serve gzip compressed CSS and JS files.
  173. # Requires both mod_rewrite and mod_headers to be enabled.
  174. <IfModule mod_headers.c>
  175. # Serve gzip compressed CSS files if they exist and the client accepts gzip.
  176. RewriteCond %{HTTP:Accept-encoding} gzip
  177. RewriteCond %{REQUEST_FILENAME}\.gz -s
  178. RewriteRule ^(.*css_[a-zA-Z0-9-_]+)\.css$ $1\.css\.gz [QSA]
  179.  
  180. # Serve gzip compressed JS files if they exist and the client accepts gzip.
  181. RewriteCond %{HTTP:Accept-encoding} gzip
  182. RewriteCond %{REQUEST_FILENAME}\.gz -s
  183. RewriteRule ^(.*js_[a-zA-Z0-9-_]+)\.js$ $1\.js\.gz [QSA]
  184.  
  185. # Serve correct content types, and prevent double compression.
  186. RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1,E=no-brotli:1]
  187. RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1,E=no-brotli:1]
  188.  
  189. <FilesMatch "(\.js\.gz|\.css\.gz)$">
  190. # Serve correct encoding type.
  191. Header set Content-Encoding gzip
  192. # Force proxies to cache gzipped & non-gzipped css/js files separately.
  193. Header append Vary Accept-Encoding
  194. </FilesMatch>
  195. </IfModule>
  196. </IfModule>
  197.  
  198. # Various header fixes.
  199. <IfModule mod_headers.c>
  200. # Disable content sniffing for all responses, since it's an attack vector.
  201. # This header is also set in FinishResponseSubscriber, which depending on
  202. # Apache configuration might get placed in the 'onsuccess' table. To prevent
  203. # header duplication, unset that one prior to setting in the 'always' table.
  204. # See "To circumvent this limitation..." in
  205. # https://httpd.apache.org/docs/current/mod/mod_headers.html.
  206. Header onsuccess unset X-Content-Type-Options
  207. Header always set X-Content-Type-Options nosniff
  208. # Disable Proxy header, since it's an attack vector.
  209. RequestHeader unset Proxy
  210. </IfModule>
  211.  
  212. # Ignore below
  213. # Password protect lower environments
  214. <IfModule mod_rewrite.c>
  215. <If "%{HTTP:X-Forwarded-Proto} == 'https' && %{ENV:AH_SITE_ENVIRONMENT} == 'dev' && req('Host') == 'dev.wsiairport.com.au'">
  216. Authtype Basic
  217. AuthName "Protected Development Environment"
  218. AuthUserFile /var/www/html/wsaco.dev/.htpasswd
  219. Require valid-user
  220. </If>
  221. <If "%{HTTP:X-Forwarded-Proto} == 'https' && %{ENV:AH_SITE_ENVIRONMENT} == 'test' && req('Host') == 'staging.wsiairport.com.au'">
  222. Authtype Basic
  223. AuthName "Protected Testing Environment"
  224. AuthUserFile /var/www/html/wsaco.test/.htpasswd
  225. Require valid-user
  226. </If>
  227. </IfModule>
  228.  
  229. <IfModule mod_rewrite.c>
  230. RewriteEngine on
  231.  
  232. # Redirect dev.westernsydney.com.au to dev.wsiairport.com.au
  233. RewriteCond %{HTTP_HOST} ^dev.westernsydney.com.au$ [NC]
  234. RewriteRule ^/?(.*) https://dev.wsiairport.com.au/$1 [L,R=301,NE]
  235.  
  236. # Redirect staging.westernsydney.com.au to staging.wsiairport.com.au
  237. RewriteCond %{HTTP_HOST} ^staging.westernsydney.com.au$ [NC]
  238. RewriteRule ^/?(.*) https://staging.wsiairport.com.au/$1 [L,R=301,NE]
  239. </IfModule>
  240.  
  241.  
  242. # These lines is to redirect robots.txt to robots_dev.txt when in non production environment,
  243. # should go at the bottom.
  244. RewriteCond %{HTTP_HOST} ^wsacostg\.prod\.acquia-sites\.com$ [NC,OR]
  245. RewriteCond %{HTTP_HOST} ^staging\.westernsydney\.com\.au$ [NC,OR]
  246. RewriteCond %{HTTP_HOST} ^staging\.wsiairport\.com\.au$ [NC,OR]
  247. RewriteCond %{HTTP_HOST} ^wsacodev\.prod\.acquia-sites\.com$ [NC,OR]
  248. RewriteCond %{HTTP_HOST} ^dev\.westernsydney\.com\.au$ [NC,OR]
  249. RewriteCond %{HTTP_HOST} ^dev\.wsiairport\.com\.au$ [NC,OR]
  250. RewriteRule ^robots.txt /robots_dev.txt [L]
  251.  
Advertisement
Add Comment
Please, Sign In to add comment