permanaj

Untitled

Dec 11th, 2024
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.76 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. # Redirect old domain to new one
  64. # RewriteCond %{HTTP_HOST} ^www.wsaco.com.au$ [NC,OR]
  65. # RewriteCond %{HTTP_HOST} ^wsaco.com.au$ [NC,OR]
  66. # RewriteCond %{HTTP_HOST} ^www.westernsydney.com.au$ [NC,OR]
  67. # RewriteCond %{HTTP_HOST} ^wsa.lndo.site$ [NC,OR]
  68. # RewriteCond %{HTTP_HOST} ^westernsydney.com.au$ [NC]
  69. # RewriteRule ^/?(.*) https://wsiairport.com.au/$1 [L,R=301,NE]
  70.  
  71. # Redirect old domains to new one
  72. RewriteCond %{HTTP_HOST} ^(www\.)?wsaco\.com\.au$ [NC,OR]
  73. RewriteCond %{HTTP_HOST} ^(www\.)?westernsydney\.com\.au$ [NC]
  74. RewriteRule ^(.*)$ https://wsiairport.com/$1 [R=301,L]
  75.  
  76. # Redirect to from wsaco.com.au to westernsydney.com.au
  77. # RewriteCond %{HTTP_HOST} ^wsaco.com.au$ [OR]
  78. # RewriteCond %{HTTP_HOST} ^www.wsaco.com.au$
  79. # RewriteRule ^(.*)$ https://westernsydney.com.au/$1 [L,R=301]
  80.  
  81. # Set "protossl" to "s" if we were accessed via https://. This is used later
  82. # if you enable "www." stripping or enforcement, in order to ensure that
  83. # you don't bounce between http and https.
  84. RewriteRule ^ - [E=protossl]
  85. RewriteCond %{HTTPS} on
  86. RewriteRule ^ - [E=protossl:s]
  87.  
  88. # Make sure Authorization HTTP header is available to PHP
  89. # even when running as CGI or FastCGI.
  90. RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  91.  
  92. # Block access to "hidden" directories whose names begin with a period. This
  93. # includes directories used by version control systems such as Subversion or
  94. # Git to store control files. Files whose names begin with a period, as well
  95. # as the control files used by CVS, are protected by the FilesMatch directive
  96. # above.
  97. #
  98. # NOTE: This only works when mod_rewrite is loaded. Without mod_rewrite, it is
  99. # not possible to block access to entire directories from .htaccess because
  100. # <DirectoryMatch> is not allowed here.
  101. #
  102. # If you do not have mod_rewrite installed, you should remove these
  103. # directories from your webroot or otherwise protect them from being
  104. # downloaded.
  105. RewriteRule "/\.|^\.(?!well-known/)" - [F]
  106.  
  107. # If your site can be accessed both with and without the 'www.' prefix, you
  108. # can use one of the following settings to redirect users to your preferred
  109. # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
  110. #
  111. # To redirect all users to access the site WITH the 'www.' prefix,
  112. # (http://example.com/foo will be redirected to http://www.example.com/foo)
  113. # uncomment the following:
  114. # RewriteCond %{HTTP_HOST} .
  115. # RewriteCond %{HTTP_HOST} !^www\. [NC]
  116. # RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  117. #
  118. # To redirect all users to access the site WITHOUT the 'www.' prefix,
  119. # (http://www.example.com/foo will be redirected to http://example.com/foo)
  120. # uncomment the following:
  121. RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
  122. RewriteRule ^ http%{ENV:protossl}://%1%{REQUEST_URI} [L,R=301]
  123.  
  124. # Modify the RewriteBase if you are using Drupal in a subdirectory or in a
  125. # VirtualDocumentRoot and the rewrite rules are not working properly.
  126. # For example if your site is at http://example.com/drupal uncomment and
  127. # modify the following line:
  128. # RewriteBase /drupal
  129. #
  130. # If your site is running in a VirtualDocumentRoot at http://example.com/,
  131. # uncomment the following line:
  132. # RewriteBase /
  133.  
  134. # Redirect common PHP files to their new locations.
  135. RewriteCond %{REQUEST_URI} ^(.*)?/(install\.php) [OR]
  136. RewriteCond %{REQUEST_URI} ^(.*)?/(rebuild\.php)
  137. RewriteCond %{REQUEST_URI} !core
  138. RewriteRule ^ %1/core/%2 [L,QSA,R=301]
  139.  
  140. # Rewrite install.php during installation to see if mod_rewrite is working
  141. RewriteRule ^core/install\.php core/install.php?rewrite=ok [QSA,L]
  142.  
  143. # Pass all requests not referring directly to files in the filesystem to
  144. # index.php.
  145. RewriteCond %{REQUEST_FILENAME} !-f
  146. RewriteCond %{REQUEST_FILENAME} !-d
  147. RewriteCond %{REQUEST_URI} !=/favicon.ico
  148. RewriteRule ^ index.php [L]
  149.  
  150. # For security reasons, deny access to other PHP files on public sites.
  151. # Note: The following URI conditions are not anchored at the start (^),
  152. # because Drupal may be located in a subdirectory. To further improve
  153. # security, you can replace '!/' with '!^/'.
  154. # Allow access to PHP files in /core (like authorize.php or install.php):
  155. RewriteCond %{REQUEST_URI} !/core/[^/]*\.php$
  156. # Allow access to test-specific PHP files:
  157. RewriteCond %{REQUEST_URI} !/core/modules/system/tests/https?\.php
  158. # Allow access to Statistics module's custom front controller.
  159. # Copy and adapt this rule to directly execute PHP files in contributed or
  160. # custom modules or to run another PHP application in the same directory.
  161. RewriteCond %{REQUEST_URI} !/core/modules/statistics/statistics\.php$
  162. # Deny access to any other PHP files that do not match the rules above.
  163. # Specifically, disallow autoload.php from being served directly.
  164. RewriteRule "^(.+/.*|autoload)\.php($|/)" - [F]
  165.  
  166. # Rules to correctly serve gzip compressed CSS and JS files.
  167. # Requires both mod_rewrite and mod_headers to be enabled.
  168. <IfModule mod_headers.c>
  169. # Serve gzip compressed CSS files if they exist and the client accepts gzip.
  170. RewriteCond %{HTTP:Accept-encoding} gzip
  171. RewriteCond %{REQUEST_FILENAME}\.gz -s
  172. RewriteRule ^(.*css_[a-zA-Z0-9-_]+)\.css$ $1\.css\.gz [QSA]
  173.  
  174. # Serve gzip compressed JS files if they exist and the client accepts gzip.
  175. RewriteCond %{HTTP:Accept-encoding} gzip
  176. RewriteCond %{REQUEST_FILENAME}\.gz -s
  177. RewriteRule ^(.*js_[a-zA-Z0-9-_]+)\.js$ $1\.js\.gz [QSA]
  178.  
  179. # Serve correct content types, and prevent double compression.
  180. RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1,E=no-brotli:1]
  181. RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1,E=no-brotli:1]
  182.  
  183. <FilesMatch "(\.js\.gz|\.css\.gz)$">
  184. # Serve correct encoding type.
  185. Header set Content-Encoding gzip
  186. # Force proxies to cache gzipped & non-gzipped css/js files separately.
  187. Header append Vary Accept-Encoding
  188. </FilesMatch>
  189. </IfModule>
  190.  
  191. RewriteCond %{HTTPS} off
  192. RewriteCond %{HTTP:X-Forwarded-Proto} !https
  193. RewriteCond %{HTTP_HOST} (.*).wsiairport.com.au$ [NC,OR]
  194. RewriteCond %{HTTP_HOST} ^wsiairport.com.au$ [NC]
  195. RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  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/%{REQUEST_URI} [R=301,NC,L]
  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/%{REQUEST_URI} [R=301,NC,L]
  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]
  250. RewriteRule ^robots.txt /robots_dev.txt [L]
  251.  
Advertisement
Add Comment
Please, Sign In to add comment