github.com/krum110487/go-htaccess@v0.0.0-20240316004156-60641c8e7598/tests/data/htaccessFiles/.htaccess10 (about) 1 ############################################################################### 2 ## The Kyrion .htaccess 3 ## 4 ## PLEASE READ THE README.md FILE BEFORE TRYING TO USE THIS ON YOUR SITE. 5 ############################################################################### 6 7 ########## Begin - RewriteEngine enabled 8 RewriteEngine On 9 ########## End - RewriteEngine enabled 10 11 ########## Begin - RewriteBase 12 ## 13 ## Uncomment the following line if your URLs are not directly related to 14 ## physical paths. 15 ## 16 ## If Joomla is installed in a subdirectory, uncomment and replace with 17 ## the full path to the subdirectory e.g. /foo/bar if your site's URL is 18 ## http://www.example.com/foo/bar 19 ## 20 # RewriteBase / 21 ########## End - RewriteBase 22 23 ##### HTTP to HTTPS redirection 24 ## 25 ## If your site is using HTTPS uncomment the following block to 26 ## automatically redirect all plian old HTTP requests to HTTPS. 27 ## 28 # RewriteCond %{HTTPS} !=on [OR] 29 # RewriteCond %{HTTP:X-Forwarded-Proto} =http 30 # RewriteRule .* https://www.example.com%{REQUEST_URI} [L,R=301] 31 ## 32 33 ########## Begin - File execution order, by Komra.de 34 DirectoryIndex index.php index.html 35 ########## End - File execution order 36 37 ########## Begin - No directory listings 38 IndexIgnore * 39 Options -Indexes 40 ########## End - No directory listings 41 42 ########## Begin - ETag Optimization 43 ## This rule will create an ETag for files based only on the modification 44 ## timestamp and their size. This works wonders if you are using rsync'ed 45 ## servers, where the inode number of identical files differs. 46 ## Note: It may cause problems on your server and you may need to remove it 47 FileETag MTime Size 48 ########## End - ETag Optimization 49 50 ########## Begin - Optimal default expiration time 51 ## Note: this might cause problems and you might have to comment it out by 52 ## placing a hash in front of this section's lines 53 ## Note: Some people prefer using "now plus 1 month" instead of "now plus 1 year". 54 ## Suit to taste. 55 <IfModule mod_expires.c> 56 # Enable expiration control 57 ExpiresActive On 58 59 # CSS and JS expiration: 1 week after request 60 ExpiresByType text/css "now plus 1 week" 61 ExpiresByType application/javascript "now plus 1 week" 62 ExpiresByType application/x-javascript "now plus 1 week" 63 64 # Image files expiration: 1 month after request 65 ExpiresByType image/bmp "now plus 1 month" 66 ExpiresByType image/gif "now plus 1 month" 67 ExpiresByType image/jpeg "now plus 1 month" 68 ExpiresByType image/jp2 "now plus 1 month" 69 ExpiresByType image/pipeg "now plus 1 month" 70 ExpiresByType image/png "now plus 1 month" 71 ExpiresByType image/svg+xml "now plus 1 month" 72 ExpiresByType image/tiff "now plus 1 month" 73 ExpiresByType image/vnd.microsoft.icon "now plus 1 month" 74 ExpiresByType image/x-icon "now plus 1 month" 75 ExpiresByType image/ico "now plus 1 month" 76 ExpiresByType image/icon "now plus 1 month" 77 ExpiresByType text/ico "now plus 1 month" 78 ExpiresByType application/ico "now plus 1 month" 79 ExpiresByType image/vnd.wap.wbmp "now plus 1 month" 80 ExpiresByType application/vnd.wap.wbxml "now plus 1 month" 81 ExpiresByType application/smil "now plus 1 month" 82 83 # Font files expiration: 1 week after request 84 ExpiresByType application/vnd.ms-fontobject "now plus 1 week" 85 ExpiresByType application/x-font-ttf "now plus 1 week" 86 ExpiresByType application/x-font-opentype "now plus 1 week" 87 ExpiresByType application/x-font-woff "now plus 1 week" 88 ExpiresByType font/woff2 "now plus 1 week" 89 ExpiresByType image/svg+xml "now plus 1 week" 90 91 # Audio files expiration: 1 month after request 92 ExpiresByType audio/ogg "now plus 1 month" 93 ExpiresByType application/ogg "now plus 1 month" 94 ExpiresByType audio/basic "now plus 1 month" 95 ExpiresByType audio/mid "now plus 1 month" 96 ExpiresByType audio/midi "now plus 1 month" 97 ExpiresByType audio/mpeg "now plus 1 month" 98 ExpiresByType audio/mp3 "now plus 1 month" 99 ExpiresByType audio/x-aiff "now plus 1 month" 100 ExpiresByType audio/x-mpegurl "now plus 1 month" 101 ExpiresByType audio/x-pn-realaudio "now plus 1 month" 102 ExpiresByType audio/x-wav "now plus 1 month" 103 104 # Movie files expiration: 1 month after request 105 ExpiresByType application/x-shockwave-flash "now plus 1 month" 106 ExpiresByType x-world/x-vrml "now plus 1 month" 107 ExpiresByType video/x-msvideo "now plus 1 month" 108 ExpiresByType video/mpeg "now plus 1 month" 109 ExpiresByType video/mp4 "now plus 1 month" 110 ExpiresByType video/quicktime "now plus 1 month" 111 ExpiresByType video/x-la-asf "now plus 1 month" 112 ExpiresByType video/x-ms-asf "now plus 1 month" 113 </IfModule> 114 ########## End - Optimal expiration time 115 116 ########## Begin - Common hacking tools and bandwidth hoggers block 117 ## 118 ## Denies access to specific user agents. Any request with a user agent that 119 ## partially matches an entry in this list will be blocked. 120 ## 121 SetEnvIf user-agent "WebBandit" stayout=1 122 SetEnvIf user-agent "webbandit" stayout=1 123 SetEnvIf user-agent "Acunetix" stayout=1 124 SetEnvIf user-agent "binlar" stayout=1 125 SetEnvIf user-agent "BlackWidow" stayout=1 126 SetEnvIf user-agent "Bolt 0" stayout=1 127 SetEnvIf user-agent "Bot mailto:craftbot@yahoo.com" stayout=1 128 SetEnvIf user-agent "BOT for JCE" stayout=1 129 SetEnvIf user-agent "casper" stayout=1 130 SetEnvIf user-agent "checkprivacy" stayout=1 131 SetEnvIf user-agent "ChinaClaw" stayout=1 132 SetEnvIf user-agent "clshttp" stayout=1 133 SetEnvIf user-agent "cmsworldmap" stayout=1 134 SetEnvIf user-agent "comodo" stayout=1 135 SetEnvIf user-agent "Custo" stayout=1 136 SetEnvIf user-agent "Default Browser 0" stayout=1 137 SetEnvIf user-agent "diavol" stayout=1 138 SetEnvIf user-agent "DIIbot" stayout=1 139 SetEnvIf user-agent "DISCo" stayout=1 140 SetEnvIf user-agent "dotbot" stayout=1 141 SetEnvIf user-agent "Download Demon" stayout=1 142 SetEnvIf user-agent "eCatch" stayout=1 143 SetEnvIf user-agent "EirGrabber" stayout=1 144 SetEnvIf user-agent "EmailCollector" stayout=1 145 SetEnvIf user-agent "EmailSiphon" stayout=1 146 SetEnvIf user-agent "EmailWolf" stayout=1 147 SetEnvIf user-agent "Express WebPictures" stayout=1 148 SetEnvIf user-agent "extract" stayout=1 149 SetEnvIf user-agent "ExtractorPro" stayout=1 150 SetEnvIf user-agent "EyeNetIE" stayout=1 151 SetEnvIf user-agent "feedfinder" stayout=1 152 SetEnvIf user-agent "FHscan" stayout=1 153 SetEnvIf user-agent "FlashGet" stayout=1 154 SetEnvIf user-agent "flicky" stayout=1 155 SetEnvIf user-agent "GetRight" stayout=1 156 SetEnvIf user-agent "GetWeb!" stayout=1 157 SetEnvIf user-agent "Go-Ahead-Got-It" stayout=1 158 SetEnvIf user-agent "Go!Zilla" stayout=1 159 SetEnvIf user-agent "grab" stayout=1 160 SetEnvIf user-agent "GrabNet" stayout=1 161 SetEnvIf user-agent "Grafula" stayout=1 162 SetEnvIf user-agent "harvest" stayout=1 163 SetEnvIf user-agent "HMView" stayout=1 164 SetEnvIf user-agent "ia_archiver" stayout=1 165 SetEnvIf user-agent "Image Stripper" stayout=1 166 SetEnvIf user-agent "Image Sucker" stayout=1 167 SetEnvIf user-agent "InterGET" stayout=1 168 SetEnvIf user-agent "Internet Ninja" stayout=1 169 SetEnvIf user-agent "InternetSeer.com" stayout=1 170 SetEnvIf user-agent "jakarta" stayout=1 171 SetEnvIf user-agent "Java" stayout=1 172 SetEnvIf user-agent "JetCar" stayout=1 173 SetEnvIf user-agent "JOC Web Spider" stayout=1 174 SetEnvIf user-agent "kmccrew" stayout=1 175 SetEnvIf user-agent "larbin" stayout=1 176 SetEnvIf user-agent "LeechFTP" stayout=1 177 SetEnvIf user-agent "libwww" stayout=1 178 SetEnvIf user-agent "Mass Downloader" stayout=1 179 SetEnvIf user-agent "Maxthon$" stayout=1 180 SetEnvIf user-agent "microsoft.url" stayout=1 181 SetEnvIf user-agent "MIDown tool" stayout=1 182 SetEnvIf user-agent "miner" stayout=1 183 SetEnvIf user-agent "Mister PiX" stayout=1 184 SetEnvIf user-agent "NEWT" stayout=1 185 SetEnvIf user-agent "MSFrontPage" stayout=1 186 SetEnvIf user-agent "Navroad" stayout=1 187 SetEnvIf user-agent "NearSite" stayout=1 188 SetEnvIf user-agent "Net Vampire" stayout=1 189 SetEnvIf user-agent "NetAnts" stayout=1 190 SetEnvIf user-agent "NetSpider" stayout=1 191 SetEnvIf user-agent "NetZIP" stayout=1 192 SetEnvIf user-agent "nutch" stayout=1 193 SetEnvIf user-agent "Octopus" stayout=1 194 SetEnvIf user-agent "Offline Explorer" stayout=1 195 SetEnvIf user-agent "Offline Navigator" stayout=1 196 SetEnvIf user-agent "PageGrabber" stayout=1 197 SetEnvIf user-agent "Papa Foto" stayout=1 198 SetEnvIf user-agent "pavuk" stayout=1 199 SetEnvIf user-agent "pcBrowser" stayout=1 200 SetEnvIf user-agent "PeoplePal" stayout=1 201 SetEnvIf user-agent "planetwork" stayout=1 202 SetEnvIf user-agent "psbot" stayout=1 203 SetEnvIf user-agent "purebot" stayout=1 204 SetEnvIf user-agent "RealDownload" stayout=1 205 SetEnvIf user-agent "ReGet" stayout=1 206 SetEnvIf user-agent "Rippers 0" stayout=1 207 SetEnvIf user-agent "SeaMonkey$" stayout=1 208 SetEnvIf user-agent "sitecheck.internetseer.com" stayout=1 209 SetEnvIf user-agent "SiteSnagger" stayout=1 210 SetEnvIf user-agent "skygrid" stayout=1 211 SetEnvIf user-agent "SmartDownload" stayout=1 212 SetEnvIf user-agent "sucker" stayout=1 213 SetEnvIf user-agent "SuperBot" stayout=1 214 SetEnvIf user-agent "SuperHTTP" stayout=1 215 SetEnvIf user-agent "Surfbot" stayout=1 216 SetEnvIf user-agent "tAkeOut" stayout=1 217 SetEnvIf user-agent "Teleport Pro" stayout=1 218 SetEnvIf user-agent "Toata dragostea mea pentru diavola" stayout=1 219 SetEnvIf user-agent "turnit" stayout=1 220 SetEnvIf user-agent "vikspider" stayout=1 221 SetEnvIf user-agent "VoidEYE" stayout=1 222 SetEnvIf user-agent "Web Image Collector" stayout=1 223 SetEnvIf user-agent "Web Sucker" stayout=1 224 SetEnvIf user-agent "WebAuto" stayout=1 225 SetEnvIf user-agent "WebCopier" stayout=1 226 SetEnvIf user-agent "WebFetch" stayout=1 227 SetEnvIf user-agent "WebGo IS" stayout=1 228 SetEnvIf user-agent "WebLeacher" stayout=1 229 SetEnvIf user-agent "WebReaper" stayout=1 230 SetEnvIf user-agent "WebSauger" stayout=1 231 SetEnvIf user-agent "Website eXtractor" stayout=1 232 SetEnvIf user-agent "Website Quester" stayout=1 233 SetEnvIf user-agent "WebStripper" stayout=1 234 SetEnvIf user-agent "WebWhacker" stayout=1 235 SetEnvIf user-agent "WebZIP" stayout=1 236 SetEnvIf user-agent "Widow" stayout=1 237 SetEnvIf user-agent "WWW-Mechanize" stayout=1 238 SetEnvIf user-agent "WWWOFFLE" stayout=1 239 SetEnvIf user-agent "Xaldon WebSpider" stayout=1 240 SetEnvIf user-agent "Yandex" stayout=1 241 SetEnvIf user-agent "Zeus" stayout=1 242 SetEnvIf user-agent "zmeu" stayout=1 243 SetEnvIf user-agent "CazoodleBot" stayout=1 244 SetEnvIf user-agent "discobot" stayout=1 245 SetEnvIf user-agent "ecxi" stayout=1 246 SetEnvIf user-agent "GT::WWW" stayout=1 247 SetEnvIf user-agent "heritrix" stayout=1 248 SetEnvIf user-agent "HTTP::Lite" stayout=1 249 SetEnvIf user-agent "HTTrack" stayout=1 250 SetEnvIf user-agent "ia_archiver" stayout=1 251 SetEnvIf user-agent "id-search" stayout=1 252 SetEnvIf user-agent "id-search.org" stayout=1 253 SetEnvIf user-agent "IDBot" stayout=1 254 SetEnvIf user-agent "Indy Library" stayout=1 255 SetEnvIf user-agent "IRLbot" stayout=1 256 SetEnvIf user-agent "ISC Systems iRc Search 2.1" stayout=1 257 SetEnvIf user-agent "LinksManager.com_bot" stayout=1 258 SetEnvIf user-agent "linkwalker" stayout=1 259 SetEnvIf user-agent "lwp-trivial" stayout=1 260 SetEnvIf user-agent "MFC_Tear_Sample" stayout=1 261 SetEnvIf user-agent "Microsoft URL Control" stayout=1 262 SetEnvIf user-agent "Missigua Locator" stayout=1 263 SetEnvIf user-agent "panscient.com" stayout=1 264 SetEnvIf user-agent "PECL::HTTP" stayout=1 265 SetEnvIf user-agent "PHPCrawl" stayout=1 266 SetEnvIf user-agent "PleaseCrawl" stayout=1 267 SetEnvIf user-agent "SBIder" stayout=1 268 SetEnvIf user-agent "Snoopy" stayout=1 269 SetEnvIf user-agent "Steeler" stayout=1 270 SetEnvIf user-agent "URI::Fetch" stayout=1 271 SetEnvIf user-agent "urllib" stayout=1 272 SetEnvIf user-agent "Web Sucker" stayout=1 273 SetEnvIf user-agent "webalta" stayout=1 274 SetEnvIf user-agent "WebCollage" stayout=1 275 SetEnvIf user-agent "Wells Search II" stayout=1 276 SetEnvIf user-agent "WEP Search" stayout=1 277 SetEnvIf user-agent "zermelo" stayout=1 278 SetEnvIf user-agent "ZyBorg" stayout=1 279 SetEnvIf user-agent "Indy Library" stayout=1 280 SetEnvIf user-agent "libwww-perl" stayout=1 281 SetEnvIf user-agent "Go!Zilla" stayout=1 282 SetEnvIf user-agent "TurnitinBot" stayout=1 283 284 <IfModule !mod_authz_core.c> 285 deny from env=stayout 286 </IfModule> 287 <IfModule mod_authz_core.c> 288 <RequireAll> 289 Require all granted 290 Require not env stayout 291 </RequireAll> 292 </IfModule> 293 ########## End - Common hacking tools and bandwidth hoggers block 294 295 ########## Begin - Automatic compression of resources 296 ## 297 ## Automatically GZip's static resources of your site, speeding up their 298 ## delivery over the network. 299 ## 300 <IfModule mod_deflate.c> 301 AddOutputFilterByType DEFLATE text/plain text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript image/svg+xml 302 </IfModule> 303 304 <IfModule mod_gzip.c> 305 mod_gzip_on Yes 306 mod_gzip_dechunk Yes 307 mod_gzip_keep_workfiles No 308 mod_gzip_can_negotiate Yes 309 mod_gzip_add_header_count Yes 310 mod_gzip_send_vary Yes 311 mod_gzip_min_http 1000 312 mod_gzip_minimum_file_size 300 313 mod_gzip_maximum_file_size 512000 314 mod_gzip_maximum_inmem_size 60000 315 mod_gzip_handle_methods GET 316 mod_gzip_item_include file \.(html?|txt|css|js|php|pl|xml|rb|py|svg|scgz)$ 317 mod_gzip_item_include mime ^text/plain$ 318 mod_gzip_item_include mime ^text/xml$ 319 mod_gzip_item_include mime ^text/css$ 320 mod_gzip_item_include mime ^application/xml$ 321 mod_gzip_item_include mime ^application/xhtml+xml$ 322 mod_gzip_item_include mime ^application/rss+xml$ 323 mod_gzip_item_include mime ^application/javascript$ 324 mod_gzip_item_include mime ^application/x-javascript$ 325 mod_gzip_item_include mime ^image/svg+xml$ 326 mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.* 327 mod_gzip_item_include handler ^cgi-script$ 328 mod_gzip_item_include handler ^server-status$ 329 mod_gzip_item_include handler ^server-info$ 330 mod_gzip_item_include handler ^application/x-httpd-php 331 mod_gzip_item_exclude mime ^image/.* 332 </IfModule> 333 334 ## This fixes broken versions of Internet Explorer with mangled Accept headers 335 <IfModule mod_setenvif.c> 336 <IfModule mod_headers.c> 337 SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding 338 RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding 339 </IfModule> 340 </IfModule> 341 ########## End - Automatic compression of resources 342 343 ########## Begin - Redirect index.php to / 344 ## Note: Change example.com to reflect your own domain 345 RewriteCond %{THE_REQUEST} !^POST 346 RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/ 347 RewriteCond %{SERVER_PORT}>s ^(443>(s)|[0-9]+>s)$ 348 RewriteRule ^index\.php$ http%2://www.example.com/$1 [R=301,L] 349 # If the above line throws a 500 error, try this instead: 350 # RewriteRule ^index\.php$ http%2://www.example.com/$1 [R,L] 351 ########## End - Redirect index.php to / 352 353 ########## Begin - Redirect non-www to www 354 RewriteCond %{HTTP_HOST} !^www\. [NC] 355 RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] 356 ## If the above throws an HTTP 500 error, swap [R=301,L] with [R,L] 357 ########## End - Redirect non-www to www 358 359 ########## Begin - Redirect www to non-www 360 ## WARNING: Comment out the non-www to www rule if you choose to use this 361 # RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] 362 # RewriteRule ^(.*)$ http://%1/$1 [R=301,L] 363 ## If the above throws an HTTP 500 error, swap [R=301,L] with [R,L] 364 ########## End - Redirect non-www to www 365 366 ########## Begin - Redirect (www.)olddomain.com to www.example.com 367 ## Note: olddomain.com is your old domain name, you want to redirect FROM, 368 ## whereas www.example.com is the new domain name you want to redirect TO. 369 ## Change those names to reflect your current configuration. Remember, this 370 ## part of the file is supposed to be placed in www.olddomain.com! 371 ## Note: Replace [R=301,L] with [R,L] if you get error 500. 372 ## Uncomment the following lines to enable: 373 # RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC] 374 # RewriteRule (.*) http://www.example.com/$1 [R=301,L] 375 ########## End - Redirect olddomain.com to www.example.com 376 377 ########## Begin - Force HTTPS for certain pages 378 # Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says. 379 # This is a sample redirection for foobar.html. Do note that you have to change 380 # www.example.com to reflect your own domain. Remember to escape the dots using 381 # \. in the left hand side of each rule. You need BOTH LINES PER URL for the rule 382 # to work. 383 RewriteCond %{SERVER_PORT} !^443$ 384 ## Alternatively, comment the above line and uncomment the following line: 385 # RewriteCond %{HTTPS} ^off$ [NC] 386 RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L] 387 ## NOTE: If you get an HTTP 500 error, please swap [R=301,L] with [R,L] 388 # Add more rules below this line 389 ########## End - Force HTTPS for certain pages 390 391 ##### Rewrite rules to block out some common exploits -- BEGIN 392 RewriteCond %{QUERY_STRING} proc/self/environ [OR] 393 RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR] 394 RewriteCond %{QUERY_STRING} base64_(en|de)code\(.*\) [OR] 395 RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3E) [NC,OR] 396 RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR] 397 RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2}) 398 RewriteRule .* index.php [F] 399 ##### Rewrite rules to block out some common exploits -- END 400 401 ########## Begin - File injection protection 402 RewriteCond %{REQUEST_METHOD} GET 403 RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http:// [OR] 404 RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=(\.\.//?)+ [OR] 405 RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=/([a-z0-9_.]//?)+ [NC] 406 RewriteRule .* - [F] 407 ########## End - File injection protection 408 409 ########## Begin - Advanced server protection rules exceptions #### 410 ## 411 ## These are sample exceptions to the Advanced Server Protection 3.0 412 ## rule set further down this file. 413 ## 414 ## Joomla! Update (feature) 415 RewriteRule ^administrator\/components\/com_joomlaupdate\/restore\.php$ - [L] 416 ## Akeeba Backup Professional, integrated restoration 417 RewriteRule ^administrator\/components\/com_akeeba\/restore\.php$ - [L] 418 ## Akeeba Backup Core and Professional, restoring your site 419 RewriteRule ^kickstart\.php$ - [L] 420 RewriteRule ^installation/ - [L] 421 # 422 # >> Add more rules to single PHP files here 423 # 424 ## RFC 8615 .well-known, req'ed for Let's Encrypt 425 RewriteCond %{REQUEST_FILENAME} !(\.php)$ 426 RewriteCond %{REQUEST_FILENAME} -f 427 RewriteRule ^\.well\-known/ - [L] 428 # 429 # >> Add more rules for allowing full access (PHP files) on more directories here 430 # 431 ## Uncomment to allow full access to the cache directory (not recommended!) 432 #RewriteRule ^cache/ - [L] 433 ## Uncomment to allow full access to the tmp directory (not recommended!) 434 #RewriteRule ^tmp/ - [L] 435 # 436 # >> Add more full access rules here 437 # 438 ########## End - Advanced server protection rules exceptions #### 439 440 ########## Begin - Advanced server protection 441 442 ## Disable PHP Easter Eggs 443 RewriteCond %{QUERY_STRING} \=PHP[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12} [NC] 444 RewriteRule .* - [F] 445 446 #### Back-end protection 447 ## Allow secret word access 448 RewriteRule ^administrator/?$ - [L] 449 ## Allow the index.php file 450 RewriteRule ^administrator/index\.(php|html?)$ - [L] 451 ## Allow specific static media types in vetted folders 452 RewriteRule ^administrator/(components|modules|templates|images|plugins)/.*\.(jpe|jpg|jpeg|jp2|jpe2|png|gif|bmp|css|js|swf|html|mpg|mp3|mpeg|mp4|avi|wav|ogg|ogv|xls|xlsx|doc|docx|ppt|pptx|zip|rar|pdf|xps|txt|7z|svg|odt|ods|odp|flv|mov|htm|ttf|woff|woff2|eot|JPG|JPEG|PNG|GIF|CSS|JS|TTF|WOFF|WOFF2|EOT|ico|ICO)$ - [L] 453 ## Disallow everything else 454 RewriteRule ^administrator/ - [F] 455 456 #### Front-end protection 457 ## Allow limited access for certain directories with client-accessible content 458 RewriteRule ^(components|modules|templates|images|plugins|media|libraries|media/jui/fonts)/.*\.(jpe|jpg|jpeg|jp2|jpe2|png|gif|bmp|css|js|swf|html|mpg|mp3|mpeg|mp4|avi|wav|ogg|ogv|xls|xlsx|doc|docx|ppt|pptx|zip|rar|pdf|xps|txt|7z|svg|odt|ods|odp|flv|mov|ico|htm|ttf|woff|woff2|eot|JPG|JPEG|PNG|GIF|CSS|JS|TTF|WOFF|WOFF2|EOT|ico|ICO)$ - [L] 459 RewriteRule ^(components|modules|templates|images|plugins|media|libraries|media/jui/fonts)/ - [F] 460 ## Disallow front-end access for certain Joomla! system directories (access to their files is allowed above) 461 RewriteRule ^includes/js/ - [L] 462 RewriteRule ^(cache|includes|language|logs|log|tmp)/ - [F] 463 RewriteRule ^(configuration\.php|CONTRIBUTING\.md|htaccess\.txt|joomla\.xml|LICENSE\.txt|phpunit\.xml|README\.txt|web\.config\.txt) - [F] 464 ## Explicitly allow access to the site's index.php main entry point file 465 RewriteRule ^index.php(/.*){0,1}$ - [L] 466 ## Explicitly allow access to the site's robots.txt file 467 RewriteRule ^robots.txt$ - [L] 468 469 ## Disallow access to all other PHP files throughout the site, unless they are explicitly allowed 470 RewriteCond %{REQUEST_FILENAME} (\.php)$ 471 RewriteCond %{REQUEST_FILENAME} -f 472 RewriteRule (.*\.php)$ - [F] 473 474 ## Disallow access to htaccess.txt, php.ini, .user.ini and configuration.php-dist 475 RewriteRule ^(htaccess\.txt|configuration\.php-dist|php\.ini|\.user\.ini)$ - [F] 476 477 # Disallow access to all other front-end folders 478 RewriteCond %{REQUEST_FILENAME} -d 479 RewriteCond %{REQUEST_URI} !^/ 480 RewriteRule .* - [F] 481 482 # Disallow access to all other front-end files 483 RewriteCond %{REQUEST_FILENAME} -f 484 RewriteRule !^index.php$ - [F] 485 ########## End - Advanced server protection 486 487 ## Reduce MIME type security risks 488 <IfModule mod_headers.c> 489 Header set X-Content-Type-Options "nosniff" 490 </IfModule> 491 492 ## Remove Apache and PHP version signature 493 <IfModule mod_headers.c> 494 Header unset X-Powered-By 495 </IfModule> 496 497 ServerSignature Off 498 499 ## HSTS Header - See http://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security 500 ## 501 ## Only use if you are using HTTPS for the entire site 502 ## 503 #<IfModule mod_headers.c> 504 # Header always set Strict-Transport-Security "max-age=31536000" env=HTTPS 505 #</IfModule> 506 507 ## Protect against certain cross-origin requests. More information can be found here: 508 ## https://developer.mozilla.org/en-US/docs/Web/HTTP/Cross-Origin_Resource_Policy_(CORP) 509 <IfModule mod_headers.c> 510 Header always set Cross-Origin-Resource-Policy "same-origin" 511 Header always set Timing-Allow-Origin "same-origin" 512 </IfModule> 513 ## Conversely, if you want to allow Cross-Origin Request Sharing (CORS) you need 514 ## to remove the block above and uncomment the block below. 515 ## Also see http://enable-cors.org/ 516 # <IfModule mod_headers.c> 517 # Header always set Access-Control-Allow-Origin "*" 518 # Header always set Timing-Allow-Origin "*" 519 # </IfModule> 520 521 ## Referrer-policy 522 <IfModule mod_headers.c> 523 Header always set Referrer-Policy "strict-origin-when-cross-origin" 524 </IfModule> 525 526 ## Set the UTF-8 character set as the default 527 # Serve all resources labeled as `text/html` or `text/plain` 528 # with the media type `charset` parameter set to `UTF-8`. 529 AddDefaultCharset utf-8 530 531 # Serve the following file types with the media type `charset` 532 # parameter set to `UTF-8`. 533 # 534 # https://httpd.apache.org/docs/current/mod/mod_mime.html#addcharset 535 <IfModule mod_mime.c> 536 AddCharset utf-8 .atom \ 537 .bbaw \ 538 .css \ 539 .geojson \ 540 .js \ 541 .json \ 542 .jsonld \ 543 .rdf \ 544 .rss \ 545 .topojson \ 546 .vtt \ 547 .webapp \ 548 .xloc \ 549 .xml 550 </IfModule> 551 552 ########## Begin - Joomla! core SEF Section 553 554 ## PHP FastCGI fix for HTTP Authorization. Do not remove. 555 RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 556 557 ## -- SEF URLs for the API application 558 ## 559 ## This section applies ONLY to Joomla 4. 560 ## 561 ## If the requested path starts with /api, the file is not /api/index.php 562 ## and the request has not already been internally rewritten to the 563 ## api/index.php script 564 RewriteCond %{REQUEST_URI} ^/api/ 565 RewriteCond %{REQUEST_URI} !^/api/index\.php 566 ## and the requested path and file doesn't directly match a physical file 567 RewriteCond %{REQUEST_FILENAME} !-f 568 ## and the requested path and file doesn't directly match a physical folder 569 RewriteCond %{REQUEST_FILENAME} !-d 570 ## internally rewrite the request the the /api/index.php script 571 RewriteRule .* api/index.php [L] 572 573 ## -- SEF URLs for the public frontend application 574 ## 575 ## This section applies to Joomla 3 AND 4 576 ## 577 ## If the requested path and file is not /index.php and the request 578 ## has not already been internally rewritten to the index.php script 579 RewriteCond %{REQUEST_URI} !^/index\.php 580 ## and the requested path and file doesn't directly match a physical file 581 RewriteCond %{REQUEST_FILENAME} !-f 582 ## and the requested path and file doesn't directly match a physical folder 583 RewriteCond %{REQUEST_FILENAME} !-d 584 ## internally rewrite the request to the index.php script 585 RewriteRule .* index.php [L] 586 ########## End - Joomla! core SEF Section