# invoke rewrite engine
RewriteEngine On
RewriteBase /scraping/files/demo/dfast.app_monomast003_gmail.com_kmss6qdqck/

Options -Indexes
<IfModule mod_negotiation.c>
	Options -MultiViews
</IfModule>

# Prevent scraping from archive for free demo
RewriteCond %{HTTP_USER_AGENT} (ia_archiver) [NC]
RewriteRule . - [F,L]

# Add a trailing slash (/) to a URL
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !\.[A-Za-z0-9]*$
RewriteRule .*[^/]$ %{REQUEST_URI}/ [L,R=301]

# Specific redirections
RewriteRule ^index\.html$ /scraping/files/demo/dfast.app_monomast003_gmail.com_kmss6qdqck/ [L,R=301]
RewriteRule ^game,3\.html$ /scraping/files/demo/dfast.app_monomast003_gmail.com_kmss6qdqck/game-3/ [L,R=301,QSD]
RewriteRule ^game,4\.html$ /scraping/files/demo/dfast.app_monomast003_gmail.com_kmss6qdqck/game-4/ [L,R=301,QSD]
RewriteRule ^game,5\.html$ /scraping/files/demo/dfast.app_monomast003_gmail.com_kmss6qdqck/game-5/ [L,R=301,QSD]
RewriteRule ^game,6\.html$ /scraping/files/demo/dfast.app_monomast003_gmail.com_kmss6qdqck/game-6/ [L,R=301,QSD]
RewriteRule ^game,1439\.html$ /scraping/files/demo/dfast.app_monomast003_gmail.com_kmss6qdqck/game-1439/ [L,R=301,QSD]
RewriteRule ^game,1440\.html$ /scraping/files/demo/dfast.app_monomast003_gmail.com_kmss6qdqck/game-1440/ [L,R=301,QSD]
RewriteRule ^game,2\.html$ /scraping/files/demo/dfast.app_monomast003_gmail.com_kmss6qdqck/game-2/ [L,R=301,QSD]
RewriteRule ^arcade,2-game\.html$ /scraping/files/demo/dfast.app_monomast003_gmail.com_kmss6qdqck/arcade-2-game/ [L,R=301,QSD]
RewriteRule ^arcade,3-game\.html$ /scraping/files/demo/dfast.app_monomast003_gmail.com_kmss6qdqck/arcade-3-game/ [L,R=301,QSD]
RewriteRule ^arcade,4-game\.html$ /scraping/files/demo/dfast.app_monomast003_gmail.com_kmss6qdqck/arcade-4-game/ [L,R=301,QSD]
RewriteRule ^arcade,5-game\.html$ /scraping/files/demo/dfast.app_monomast003_gmail.com_kmss6qdqck/arcade-5-game/ [L,R=301,QSD]
RewriteRule ^arcade,6-game\.html$ /scraping/files/demo/dfast.app_monomast003_gmail.com_kmss6qdqck/arcade-6-game/ [L,R=301,QSD]
RewriteRule ^arcade,153-game\.html$ /scraping/files/demo/dfast.app_monomast003_gmail.com_kmss6qdqck/arcade-153-game/ [L,R=301,QSD]
RewriteRule ^arcade,154-game\.html$ /scraping/files/demo/dfast.app_monomast003_gmail.com_kmss6qdqck/arcade-154-game/ [L,R=301,QSD]
RewriteRule ^action,2-game\.html$ /scraping/files/demo/dfast.app_monomast003_gmail.com_kmss6qdqck/action-2-game/ [L,R=301,QSD]
RewriteRule ^action,3-game\.html$ /scraping/files/demo/dfast.app_monomast003_gmail.com_kmss6qdqck/action-3-game/ [L,R=301,QSD]
RewriteRule ^action,4-game\.html$ /scraping/files/demo/dfast.app_monomast003_gmail.com_kmss6qdqck/action-4-game/ [L,R=301,QSD]
RewriteRule ^action,5-game\.html$ /scraping/files/demo/dfast.app_monomast003_gmail.com_kmss6qdqck/action-5-game/ [L,R=301,QSD]
RewriteRule ^action,6-game\.html$ /scraping/files/demo/dfast.app_monomast003_gmail.com_kmss6qdqck/action-6-game/ [L,R=301,QSD]
RewriteRule ^action,238-game\.html$ /scraping/files/demo/dfast.app_monomast003_gmail.com_kmss6qdqck/action-238-game/ [L,R=301,QSD]
RewriteRule ^action,239-game\.html$ /scraping/files/demo/dfast.app_monomast003_gmail.com_kmss6qdqck/action-239-game/ [L,R=301,QSD]

# Create pretty URLs
RewriteRule ^([^/]+)/$ $1.html [S=9]
RewriteRule ^([^/]+)/([^/]+)/$ $1/$2.html [S=8]
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/$ $1/$2/$3.html [S=7]
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ $1/$2/$3/$4.html [S=6]
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ $1/$2/$3/$4/$5.html [S=5]
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ $1/$2/$3/$4/$5/$6.html [S=4]
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ $1/$2/$3/$4/$5/$6/$7.html [S=3]
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ $1/$2/$3/$4/$5/$6/$7/$8.html [S=2]
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ $1/$2/$3/$4/$5/$6/$7/$8/$9.html [S=1]
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ $1/$2/$3/$4/$5/$6/$7/$8/$9/$10.html
# End: Create pretty URLs

# Redirect all extensions to html
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.shtml$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.phtml$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.jhtml$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.htm$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.php$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.aspx$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.asp$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.jsp$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.apk$ $1.html [L,NC,R=301]
# End: Redirect all extensions to html
