# Add a trailing slash (/) to a URL
rewrite ^([^.]*[^/])$ $1/ permanent;

# Specific redirections
if ($args ~* ^page_id=108$){ rewrite ^//?$ /page_id-108/? permanent; }
if ($args ~* ^page_id=109$){ rewrite ^//?$ /page_id-109/? permanent; }
if ($args ~* ^page_id=184$){ rewrite ^//?$ /page_id-184/? permanent; }
if ($args ~* ^page_id=187$){ rewrite ^//?$ /page_id-187/? permanent; }
if ($args ~* ^page_id=190$){ rewrite ^//?$ /page_id-190/? permanent; }
if ($args ~* ^success_redirect_url=\%2F\%3Fwordfence_lh\%3D1\%26hid\%3D1D49176F7C1807B6C6FC58E4B750B899\%26r\%3D0\.47401834705075446$){ rewrite ^/login_up\.php$ /login_up.php-success_redirect_url-/wordfence_lh-1-hid-1D49176F7C1807B6C6FC58E4B750B899-r-0_47401834705075446/? permanent; }
if ($args ~* ^success_redirect_url=\%2F\%3Fwordfence_lh\%3D1\%26hid\%3D1D49176F7C1807B6C6FC58E4B750B899\%26r\%3D0\.8262774348422497$){ rewrite ^/login_up\.php$ /login_up.php-success_redirect_url-/wordfence_lh-1-hid-1D49176F7C1807B6C6FC58E4B750B899-r-0_8262774348422497/? permanent; }
if ($args ~* ^success_redirect_url=\%2Fcp\%2Fjavascript\%2Fadmin\.components\.forms\.settings-ui\.branding\.background\.fit$){ rewrite ^/login_up\.php$ /login_up_success_redirect_url-_cp_javascript_admin_components_forms_settings-ui_branding_background_fit/? permanent; }

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

# Redirect all extensions to html
if ($is_args = ''){
	rewrite ^([^.]*)\.shtml$ $1.html permanent;
	rewrite ^([^.]*)\.phtml$ $1.html permanent;
	rewrite ^([^.]*)\.jhtml$ $1.html permanent;
	rewrite ^([^.]*)\.htm$ $1.html permanent;
	rewrite ^([^.]*)\.php$ $1.html permanent;
	rewrite ^([^.]*)\.aspx$ $1.html permanent;
	rewrite ^([^.]*)\.asp$ $1.html permanent;
	rewrite ^([^.]*)\.jsp$ $1.html permanent;
	rewrite ^([^.]*)\.apk$ $1.html permanent;
}
# End: Redirect all extensions to html
