# invoke rewrite engine
RewriteEngine On
RewriteBase /

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

# Redirect non-www to www
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

# Create pretty URLs
DirectorySlash Off

RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^ %{REQUEST_URI}.html [NC,L]
# End: Create pretty URLs

# Specific redirections
RewriteRule ^index\.html$ / [L,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^index\.htm$ index_htm.html [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^D=D$
RewriteRule ^97v3/chignell/_vti_cnf$ 97v3/chignell/_vti_cnf/D-D.html [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^M=A$
RewriteRule ^97v3/chignell/_vti_cnf$ 97v3/chignell/_vti_cnf/M-A.html [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^N=A$
RewriteRule ^97v3/chignell/_vti_cnf$ 97v3/chignell/_vti_cnf/N-A.html [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^N=D$
RewriteRule ^97v3/chignell/_vti_cnf$ 97v3/chignell/_vti_cnf/N-D.html [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^S=A$
RewriteRule ^97v3/chignell/_vti_cnf$ 97v3/chignell/_vti_cnf/S-A.html [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^D=A$
RewriteRule ^97v3/chignell$ 97v3/chignell/D-A.html [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^D=D$
RewriteRule ^97v3/chignell$ 97v3/chignell/D-D.html [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^N=A$
RewriteRule ^97v3/chignell$ 97v3/chignell/N-A.html [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^N=D$
RewriteRule ^97v3/chignell$ 97v3/chignell/N-D.html [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^S=D$
RewriteRule ^97v3/chignell$ 97v3/chignell/S-D.html [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^D=A$
RewriteRule ^97v3$ 97v3/D-A.html [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^M=A$
RewriteRule ^97v3$ 97v3/M-A.html [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^N=D$
RewriteRule ^97v3$ 97v3/N-D.html [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^S=A$
RewriteRule ^97v3$ 97v3/S-A.html [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^tag=heelisp&p=http\%3A\%2F\%2Fwww\.netsci-journal\.com&j=y&srw=$
RewriteRule ^$ -j-y-srw.html [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^tag=heelisp&p=http$
RewriteRule ^$ tag-heelisp-p-http.html [L,R=301,QSD]

# 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
