# invoke rewrite engine
RewriteEngine On
RewriteBase /

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

# 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$ / [L,R=301]
RewriteCond %{QUERY_STRING} ^page_id=108$
RewriteRule ^/?$ page_id-108/ [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^page_id=109$
RewriteRule ^/?$ page_id-109/ [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^page_id=184$
RewriteRule ^/?$ page_id-184/ [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^page_id=187$
RewriteRule ^/?$ page_id-187/ [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^page_id=190$
RewriteRule ^/?$ page_id-190/ [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^success_redirect_url=\%2F\%3Fwordfence_lh\%3D1\%26hid\%3D1D49176F7C1807B6C6FC58E4B750B899\%26r\%3D0\.47401834705075446$
RewriteRule ^login_up\.php$ login_up.php-success_redirect_url-/wordfence_lh-1-hid-1D49176F7C1807B6C6FC58E4B750B899-r-0_47401834705075446/ [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^success_redirect_url=\%2F\%3Fwordfence_lh\%3D1\%26hid\%3D1D49176F7C1807B6C6FC58E4B750B899\%26r\%3D0\.8262774348422497$
RewriteRule ^login_up\.php$ login_up.php-success_redirect_url-/wordfence_lh-1-hid-1D49176F7C1807B6C6FC58E4B750B899-r-0_8262774348422497/ [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^success_redirect_url=\%2Fcp\%2Fjavascript\%2Fadmin\.components\.forms\.settings-ui\.branding\.background\.fit$
RewriteRule ^login_up\.php$ login_up_success_redirect_url-_cp_javascript_admin_components_forms_settings-ui_branding_background_fit/ [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
