# disable file listing in any directory for security
Options -Indexes

# Because file can be served from multiple servers
FileETag None

# Custom error files
ErrorDocument 401 /index.php?mod=Helps&do=httperror&code=401
ErrorDocument 403 /index.php?mod=Helps&do=httperror&code=403
ErrorDocument 404 /as/helpers/ascustom_error404.php
ErrorDocument 412 /index.php?mod=Helps&do=httperror&code=412
ErrorDocument 500 /index.php?mod=Helps&do=httperror&code=500

## DEFLATE ##
<IfModule mod_deflate.c>
	AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript text/css
	AddOutputFilterByType DEFLATE application/xhtml+xml
	AddOutputFilterByType DEFLATE application/xml
	AddOutputFilterByType DEFLATE application/x-javascript

	# let PHP deal w/ its own compression, only compress standard files (.js, .css)
	# mod_deflate see 2 headers and considered as text/html even PHP sent image/gif
	# Bug: https://issues.apache.org/bugzilla/show_bug.cgi?id=33499
	SetEnvIfNoCase Request_URI "\.php$" no-gzip 
	
	
	#AddOutputFilterByType DEFLATE application/x-httpd-php
	#AddOutputFilterByType DEFLATE application/x-httpd-fastphp
</IfModule>

## EXPIRE HEADER - PERFORMANCE ##
<IfModule mod_expires.c>
	ExpiresActive On
	ExpiresByType image/x-icon "access plus 9 months"
	ExpiresByType image/gif "access plus 3 months"
	ExpiresByType image/png "access plus 3 months"
	ExpiresByType image/jpg "access plus 3 months"
	ExpiresByType image/jpeg "access plus 3 months"
	ExpiresByType application/x-shockwave-flash "access plus 3 months"
	ExpiresByType text/css "access plus 1 month"
	ExpiresByType text/javascript "access plus 1 month"
	ExpiresByType application/x-javascript "access plus 1 month"
</IfModule>

## REWRITE SECTION ##
<IfModule mod_rewrite.c>
	RewriteEngine On
	
	# Logging (0 to disable)
	#RewriteLog "/tmp/mod_rewrite.log"
	#RewriteLogLevel 2
	
	# 2018-12-13 16:33:18 - Attack DoS from an embed code rutube.ru (reference: search email for FaviconBaiting)
	# RewriteCond %{REQUEST_FILENAME} favicon.ico$
	# RewriteCond %{HTTP_REFERER} rutube\.ru
	# RewriteRule ^(.*)$ https://mcdn.adspeed.com/img/as/adspeed.ico [R=301,L]
	
	
	###### Section: Ad Serving - Old ad tags point to adspeed.com, redirect to ad serving domain
	# 2014-10-28 - southernpigskin.com (test URL: dev.as/ad.php?do=js&zid=25998&wd=-1&ht=-1)
	# 2014-10-28 - bonusslot.co.uk (test URL: dev.as/ad.php?do=js&aid=210883)
	# 2021-09-23 - moved this logic directly into PHP, easier to debug, should white-list to only certain zid
	#RewriteCond %{REQUEST_FILENAME} ad.php$
	#RewriteCond %{QUERY_STRING} (zid|zids|aid)=[0-9]+
	#RewriteCond %{HTTP_HOST} adspeed\.com$
	#RewriteRule ^(.*)$ https://g.adspeed.net/$1 [R=301,L]
	
	# IP => hostname (2016-08-19 re-checked, look like mod_security already block access via IP)
	# 2020-01-11 20:47:05 - remove mod_security rule 960017
	RewriteCond %{HTTP_HOST} ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$
	RewriteRule ^(.*)$ https://www.adspeed.com/$1 [R=301,L]
	
	# IPv6 uses square bracket
	RewriteCond %{HTTP_HOST} ^\[([a-f0-9:]+:+)+[a-f0-9]+\]$
	RewriteRule ^(.*)$ https://www.adspeed.com/$1 [R=301,L]
	
	# Special subdomains
	RewriteCond %{HTTP_HOST} ^support\.adspeed\.com$
	RewriteRule ^(.*)$ https://www.adspeed.com/Knowledges.html [R=301,L]

	RewriteCond %{HTTP_HOST} ^blog\.adspeed\.com$
	RewriteRule ^(.*)$ https://www.adspeed.com/Blog.html [R=301,L]
	# cannot avoid redirection, got 500 error 8/1/2008

	RewriteCond %{HTTP_HOST} ^demo\.adspeed\.com$
	RewriteRule ^(.*)$ https://www.adspeed.com/Demo-AdServer.html [R=301,L]

	# Live Help
	RewriteCond %{HTTP_HOST} ^chat\.adspeed\.com$
	RewriteRule ^(.*)$ https://www.adspeed.com/nsync/livehelp/ [R=301,L]

	# API, do not redirect to www, no not 301
	RewriteCond %{HTTP_HOST} ^(api|api2|api1)\.adspeed\.com$
	RewriteCond %{QUERY_STRING} ^(.*)$
	RewriteRule ^(.*)$ xml.php?mod=APIs&do=run&%1 [L]
	
	### SECTION: Redirect old links to more intuitive links 
	# @since 2014-09-25 10:02:28
	# instead http=>https=>new URL, direct: http=>new SSL URL
	# Must place before the SSL enforcer	
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule Knowledges/31/Features.html$ https://www.adspeed.com/Features.html [R=301,L]
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule Knowledges/15/Blog.html$ https://www.adspeed.com/Blog.html [R=301,L]
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule Knowledges/5/Content/About_AdSpeed_Ad_Server.html$ https://www.adspeed.com/About-AdSpeed-Ad-Server.html [R=301,L]


	# Maintain one source "https://www." only, also redirect other non-special domains to the main domain
	
	# Only allow SSL on certain domains
	RewriteCond %{SERVER_PORT} ^443$
	RewriteCond %{HTTP_HOST} !^www[0-9x]{0,1}\.adspeed\.com$
	RewriteCond %{HTTP_HOST} !^my\.adspeed\.com$
	RewriteCond %{HTTP_HOST} !^mcdn\.adspeed\.com$
	RewriteCond %{HTTP_HOST} !^ads\.123finder\.com$
	RewriteCond %{HTTP_HOST} !^clients\.gladexchange\.com$
	RewriteCond %{HTTP_HOST} !^banners\.clasificadosonline\.com$
	RewriteCond %{HTTP_HOST} !^adclients\.fsastore\.com$
	RewriteCond %{HTTP_HOST} !^ads\.activeemails\.com$
	RewriteCond %{HTTP_HOST} !^ads\.trustetc\.com$
	RewriteCond %{HTTP_HOST} !^ads\.estateflow\.com$
	RewriteCond %{HTTP_HOST} !^advertiser\.tenband\.tv$
	RewriteCond %{HTTP_HOST} !^admanager\.upnexttvnetwork\.com$
	RewriteCond %{HTTP_HOST} !^ads\.floridacomiccons\.com$
	RewriteCond %{HTTP_HOST} !^auth\.mediapilot\.io$
	RewriteCond %{HTTP_HOST} !^log\.adspeed\.com$
	
	RewriteRule ^(.*)$ https://www.adspeed.com/$1 [R=301,L]
	
	# Enforce SSL
	RewriteCond %{SERVER_PORT} !^443$
	# 2014-09-24 - don't force SSL w/ special var nofsslXXX=md5 (any potential security/SEO issue?)
	RewriteCond %{QUERY_STRING} !(^|&)nofssl20140924=[0-9a-f]{32}($|&) 
	
	# 2016-03-14 - redirect from m. back to www. (maintain one domain, v4 is responsive) => comment out next line
	#RewriteCond %{HTTP_HOST} !^m\.adspeed\.com$	
	
	#RewriteCond %{HTTP_HOST} !^www\.adspeed\.com$
	#RewriteCond %{HTTP_HOST} !^v4\.adspeed\.com$
	#RewriteCond %{HTTP_HOST} !^api\.adspeed\.com$
	
	RewriteCond %{HTTP_HOST} !^s[0-9]{1,2}\.adspeed\.us$
	RewriteCond %{HTTP_HOST} !^g\.adspeed\.net$	
	RewriteCond %{HTTP_HOST} ^(.*)adspeed\.(.+)$
	RewriteRule ^(.*)$ https://www.adspeed.com/$1 [R=301,L]
	
	# 2020-10-02 - eg: /index.php/xxxxxx.html
	RewriteCond %{REQUEST_URI} index\.php/.+
	RewriteRule ^(.*)$ / [R=301,L]

	# Default index.php should not be shown
	# having some issue (w/ new MB), leave it disable for now (Jan 7, 09)
	#RewriteCond %{REQUEST_URI} index\.php$
	#RewriteCond %{HTTP_HOST} ^www\.adspeed\.com$
	#RewriteCond %{QUERY_STRING} ^$
	#RewriteRule ^(.*)$ / [R=301,L]
	#RewriteRule ^(.*)index\.php$ $1 [R=301,L]
	
	#RewriteCond %{THE_REQUEST} ^GET\ /(.*)/index\.php\ HTTP
	#RewriteRule index\.php$ $1 [R=301,L]
	
	###### Localization/Language
	#RewriteCond %{REQUEST_FILENAME} !-f 
	#RewriteCond %{REQUEST_URI} \/(es|vi|en)
	#RewriteRule /(es|vi|en)/(.+)$ $2&lang=$1 [NC,L]
	
	# Section: Alias for QuantumGateway (allowed URL is only all lower case and no .html)
	RewriteCond %{REQUEST_FILENAME} !-f 
	RewriteRule quantumgatewaypassback$ index.php?mod=Plans&do=QuantumGateway [L]
	
	# Section: Alias for sitemap.xml
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule Helps/xmlsitemap.xml$ /sitemap.xml [R=301,L]
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule Helps/sitemap.html$ /sitemap.html [R=301,L]
	
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule ^sitemap\.xml$ xml.php?mod=Helps&do=xmlsitemap [NC,L]
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule ^sitemap\.html$ index.php?mod=Helps&do=sitemap [NC,L]
	
	# Section: Placeholder image/ad
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule ^placeholder-([0-9]{1,3}+)x([0-9]{1,3}+)\.gif$ index.php?mod=Images&do=samplead&wd=$1&ht=$2&txt=$1x$2 [NC,L]
	RewriteRule ^placeholder-([0-9]{1,3}+)x([0-9]{1,3}+)-([A-Za-z0-9-_\+]+)\.gif$ index.php?mod=Images&do=samplead&wd=$1&ht=$2&txt=$1x$2+$3 [NC,L]

	##################  SEO for KB
	
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule Sales_Inquiries.html$ index.php?mod=Tickets&do=add&type=Sales [NC,L]
	
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule Help/contact.html$ /Helps/contact.html [R=301,L]
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule Helps/contact.html$ index.php?mod=Tickets&do=add [NC,L]
	
	#### Special redirect for template v4 (either not specifically set at v3 or using v4 subdomain)
	RewriteCond %{HTTP_COOKIE} !tpl=v3;? [OR]
	RewriteCond %{HTTP_HOST} ^v4\.adspeed\.com$
	RewriteRule Features.html$ index.php?mod=Knowledges&do=question&seo=0&sa=1&id=1742 [NC,L]
	RewriteCond %{HTTP_COOKIE} !tpl=v3;? [OR]
	RewriteCond %{HTTP_HOST} ^v4\.adspeed\.com$
	RewriteRule Demo-AdServer.html$ index.php?mod=Knowledges&do=question&seo=0&sa=1&id=1744 [NC,L]
	RewriteCond %{HTTP_COOKIE} !tpl=v3;? [OR]
	RewriteCond %{HTTP_HOST} ^v4\.adspeed\.com$
	RewriteRule Plans.html$ index.php?mod=Knowledges&do=question&seo=0&sa=1&id=1746 [NC,L]
	
	# Display the section content directly
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule Features.html$ index.php?mod=Knowledges&do=show&id=31 [NC,L]
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule Blog.html$ index.php?mod=Knowledges&do=show&id=15 [NC,L]
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule Services.html$ index.php?mod=Knowledges&do=show&id=27 [NC,L]
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule Products.html$ index.php?mod=Knowledges&do=show&id=58 [NC,L]
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule Ad-Tools.html$ index.php?mod=Knowledges&do=show&id=60 [NC,L]
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule Ad-Gallery.html$ index.php?mod=Knowledges&do=show&id=56 [NC,L]
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule Add-ons.html$ index.php?mod=Knowledges&do=show&id=37 [NC,L]
	
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule Forgot-Password.html$ index.php?mod=Knowledges&do=question&id=111 [NC,L]
	
	# Example: /Blog/one-two-three-1598.html
	RewriteCond %{REQUEST_URI} /Blog/ [NC]
	RewriteRule Blog/(.+)-([0-9]+).html$ index.php?mod=Knowledges&do=question&id=$2 [NC,L]
	
	# Eg: /Blog/Topics.html
	RewriteCond %{REQUEST_URI} /Blog/ [NC]
	RewriteRule Blog/Topics.html$ index.php?mod=Knowledges&do=topic&sid=15 [NC,L]
	
	# Eg: /Blog/Ad-Security.html or /Blog/Author-John-Z.html
	RewriteCond %{REQUEST_URI} /Blog/ [NC]
	RewriteRule Blog/Author-([A-Za-z-]+).html$ index.php?mod=Knowledges&do=topic&sid=15&author=$1 [NC,L]
	RewriteRule Blog/([A-Za-z-]+).html$ index.php?mod=Knowledges&do=topic&sid=15&topic=$1 [NC,L]
	
	
	RewriteCond %{REQUEST_URI} Ad-Gallery [NC]
	RewriteRule Ad-Gallery/(.+)-([0-9]+).html$ index.php?mod=Knowledges&do=question&id=$2 [NC,L]
	
	RewriteCond %{REQUEST_URI} Ad-Tools [NC]
	RewriteRule Ad-Tools/(.+)-([0-9]+).html$ index.php?mod=Knowledges&do=question&id=$2 [NC,L]
	
	RewriteCond %{REQUEST_URI} Add-ons [NC]
	RewriteRule Add-ons/(.+)-([0-9]+).html$ index.php?mod=Knowledges&do=question&id=$2 [NC,L]
	
	# Individual pages
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule Privacy-Statement.html$ index.php?mod=Knowledges&do=question&sa=1&id=1 [NC,L]
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule Privacy-Statement-Ad-Serving.html$ index.php?mod=Knowledges&do=question&sa=1&id=188 [NC,L]
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule Terms-of-Service.html$ index.php?mod=Knowledges&do=question&sa=1&id=2 [NC,L]
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule About-AdSpeed-Ad-Server.html$ index.php?mod=Knowledges&do=question&sa=1&id=5 [NC,L]
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule Guidelines-Private-Branding.html$ index.php?mod=Knowledges&do=question&sa=1&id=1040 [NC,L]
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule Careers.html$ index.php?mod=Knowledges&do=question&sa=1&id=104 [NC,L]
	
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule Demo-AdServer.html$ index.php?mod=Knowledges&do=question&id=208 [NC,L]
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule ^Clients.html$ index.php?mod=Knowledges&do=question&id=100 [NC,L]
	
	# Section: Products
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule Products/Ad-Server-Advertisers.html$ index.php?mod=Knowledges&do=question&id=122 [NC,L]
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule Products/Ad-Server-Agencies.html$ index.php?mod=Knowledges&do=question&id=1205 [NC,L]
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule Products/Ad-Server-Ad-Networks.html$ index.php?mod=Knowledges&do=question&id=966 [NC,L]
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule Products/Ad-Server-Publishers.html$ index.php?mod=Knowledges&do=question&id=1650 [NC,L]
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule Products/Fast-Delivery-Ad-Media-Manager.html$ index.php?mod=Knowledges&do=question&id=60 [NC,L]
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule Products/Private-Branding-White-Label.html$ index.php?mod=Knowledges&do=question&id=771 [NC,L]
	
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule Features/Ad-Tracking.html$ index.php?mod=Knowledges&do=question&id=799 [NC,L]
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule Services/how-does-adserving-work.html$ index.php?mod=Knowledges&do=question&id=161 [NC,L]
	
	# Example: /Knowledges/19/Overview.html
	RewriteCond %{REQUEST_URI} Knowledges [NC]
	RewriteRule Knowledges/([0-9]+)/([^/]+).html$ index.php?mod=Knowledges&do=show&id=$1 [NC,L]
	
	# Example: /Knowledges/161/Overview/How-it-works-Remotely-Hosted-Ad-Serving.html
	RewriteCond %{REQUEST_URI} Knowledges [NC]
	RewriteRule Knowledges/([0-9]+)/([^/]+)/([^.]+).html$ index.php?mod=Knowledges&do=question&id=$1 [NC,L]
	
	###### SEO for other HTML modules

	# Case 1: one module, one basic op with extra params
	# eg: ModuleName/doAction.html?key=value&key2=value2
	RewriteCond %{REQUEST_FILENAME} !-f 
	RewriteCond %{REQUEST_URI} \.html$
	RewriteCond %{QUERY_STRING} ^(.+)$
	RewriteRule ([A-Z][^/]+)/([^\.]+)\.html?(.+)$ index.php?mod=$1&do=$2&%1 [L]

	# Case 2: one module and one basic op
	# eg: ModuleName/doAction.html
	RewriteCond %{REQUEST_FILENAME} !-f 
	RewriteCond %{REQUEST_URI} \.html$
	RewriteRule ([A-Z][^/]+)/([^\.]+)\.html$ index.php?mod=$1&do=$2 [L]

	# Case 3: a module with extra params
	# eg: ModuleName.html?tab=XML
	RewriteCond %{REQUEST_FILENAME} !-f 
	RewriteCond %{REQUEST_URI} \.html$
	RewriteCond %{QUERY_STRING} ^(.+)$
	RewriteRule ([A-Z][^\.]+)\.html?(.+)$ index.php?mod=$1&%1 [L]

	# Case 4: simply the module
	# eg: ModuleName.html
	RewriteCond %{REQUEST_FILENAME} !-f 
	RewriteCond %{REQUEST_URI} \.html$
	RewriteRule ([A-Z][^\.]+)\.html$ index.php?mod=$1 [L]
	
	# Case 5: the module as a directory
	# eg: /ModuleName/ => ModuleName.html
	RewriteCond %{REQUEST_FILENAME} !-f 
	RewriteRule ^([A-Z][A-Za-z-_]+)$ /$1.html [R=301,L]
	RewriteRule ^([A-Z][A-Za-z-_]+)/$ /$1.html [R=301,L]

	###### SEO for other XML modules

	# Case 1: one module, one basic op with extra params
	# eg: Zones/tree.xml?result=pass&amount=3
	RewriteCond %{REQUEST_FILENAME} !-f 
	RewriteCond %{REQUEST_URI} \.xml$
	RewriteCond %{QUERY_STRING} ^(.+)$
	RewriteRule ([A-Z][^/]+)/([^\.]+)\.xml?(.+)$ xml.php?mod=$1&do=$2&%1 [L]

	# Case 2: one module and one basic op
	# eg: Zones/tree.xml
	RewriteCond %{REQUEST_FILENAME} !-f 
	RewriteCond %{REQUEST_URI} \.xml$
	RewriteRule ([A-Z][^/]+)/([^\.]+)\.xml$ xml.php?mod=$1&do=$2 [L]

	# Case 3: a module with extra params
	# eg: Plans.xml?tab=XML
	RewriteCond %{REQUEST_FILENAME} !-f 
	RewriteCond %{REQUEST_URI} \.xml$
	RewriteCond %{QUERY_STRING} ^(.+)$
	RewriteRule ([A-Z][^\.]+)\.xml?(.+)$ xml.php?mod=$1&%1 [L]

	# Case 4: simply the module
	# eg: Plans.xml
	RewriteCond %{REQUEST_FILENAME} !-f 
	RewriteCond %{REQUEST_URI} \.xml$
	RewriteRule ([A-Z][^\.]+)\.xml$ xml.php?mod=$1 [L]

	# a tmp patch for the new webroot eg: /js/file.js => webroot/js/file.js
	#RewriteRule ^js/(.+)$ webroot/js/$1 [L]
	
	# transition period
	RewriteCond %{REQUEST_FILENAME} !-f 
	RewriteRule ^img/(.+)$ webroot/img/$1 [L]
	
	# MaxCDN problem 2021-10-18
	# normal: mcdn.adspeed.com CNAME cdn.adspeedcom.netdna-cdn.com (mcdn = www.adspeed.com/webroot)
	# tmp 2021-10-18 mcdn.adspeed.com CNAME www4, need to rewrite a few things
	RewriteCond %{REQUEST_FILENAME} !-f 
	RewriteRule ^fw/img/(.+)$ webroot/fw/img/$1 [L]
	RewriteCond %{REQUEST_FILENAME} !-f 
	RewriteRule ^fw/js/(.+)$ webroot/fw/js/$1 [L]
	
	RewriteCond %{REQUEST_FILENAME} !-f 
	RewriteRule ^js/(.+)$ webroot/js/$1 [L]
	
	# transition period
	RewriteCond %{REQUEST_FILENAME} !-f 
	RewriteRule ^pdf/(.+)$ webroot/pdf/$1 [L]
	
	# transition period
	# 2024-06-24 - don't want to waste BW on r4 (speed too), all mp4 on workers
	RewriteCond %{REQUEST_FILENAME} !-f 
	RewriteRule ^mp4/(.+)$ https://g.adspeed.net/webroot/mp4/$1 [R,L]
	# RewriteRule ^mp4/(.+)$ webroot/mp4/$1 [L]
	
	# transition period
	RewriteCond %{REQUEST_FILENAME} !-f 
	RewriteRule ^clients/(.+)$ webroot/clients/$1 [L]
	
	# transition period to v4
	RewriteCond %{REQUEST_FILENAME} !-f 
	RewriteRule ^v4/(.+)$ webroot/v4/$1 [L]
	
	# transition period (moved to new loc, redirect old => new)
	##RewriteCond %{REQUEST_FILENAME} !-f 
	##RewriteRule ^as/media/banners/(.+)$ webroot/img/banners/$1 [L]
	##RewriteCond %{REQUEST_FILENAME} !-f 
	##RewriteRule ^as/media/screenshots/(.+)$ webroot/img/screenshots/$1 [L]
	##RewriteCond %{REQUEST_FILENAME} !-f 
	##RewriteRule ^as/docs/(.+)$ webroot/img/docs/$1 [L]
	
	RewriteCond %{REQUEST_FILENAME} !-f 
	RewriteRule ^swf/(.+)$ webroot/swf/$1 [L]
	
	RewriteCond %{REQUEST_FILENAME} !-f 
	RewriteRule ^tests/(.+)$ webroot/tests/$1 [L]
	
	RewriteCond %{REQUEST_FILENAME} !-f 
	RewriteRule ^plugins/(.+)$ webroot/plugins/$1 [L]
	
	# for shorten Fast-Delivery URL
	RewriteCond %{REQUEST_FILENAME} !-f 
	RewriteRule ^assets/(.+)$ webroot/freq/ufast/$1 [L]
	
	#RewriteRule ^img/cache/(.+)$ webroot/img/cache/$1 [L] # conflict w/ the current img folder
	#RewriteRule ^css/(.+)$ webroot/css/$1 [L]
	#RewriteRule ^media/(.+)$ webroot/media/$1 [L]

	# Section: Alias for mobile icons
	RewriteCond %{REQUEST_FILENAME} apple-touch-icon.png$ [NC,OR]
	RewriteCond %{REQUEST_FILENAME} apple-touch-icon-precomposed.png$ [NC]
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule .* /webroot/img/as/adspeed_48x48.png [L]

	# 2020-01-04 17:38:59 - to block bad bots, use fail2ban instead

</IfModule>
