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

# Specific redirections
rewrite ^/%2Fknitlet-archive-2022%2F%3Felementor-preview%3D8583%26ver%3D1647875365&amp;flash\=0&amp;wgl\=1&amp;dt\=1647875469538&amp;bpp\=13&amp;bdt\=97468&amp;idt\=-M&amp;shv\=r20220316&amp;mjsv\=m202203100101&amp;ptt\=9&amp;saldr\=aa&amp;cookie\=ID%3D70ea0100af69a350-2268bbdc5ecd0044%3AT%3D1647593639%3ART%3D1647593639%3AS%3DALNI_Maqr4rgAIUzRdbXk-TG5f5UYDUo-w&amp;prev_fmts\=0x0%2C941x200%2C941x200&amp;nras\=1&amp;correlator\=7260205120977&amp;frm\=21&amp;ife\=1&amp;pv\=1&amp;ga_vid\=2050272173\.1645953409&amp;ga_sid\=1647875379&amp;ga_hid\=1134527749&amp;ga_fc\=1&amp;nhd\=1&amp;rplot\=4&amp;u_tz\=120&amp;u_his\=4&amp;u_h\=900&amp;u_w\=1440&amp;u_ah\=813&amp;u_aw\=1440&amp;u_cd\=24&amp;u_sd\=1&amp;adx\=385&amp;ady\=-195&amp;biw\=1430&amp;bih\=581&amp;isw\=1150&amp;ish\=581&amp;ifk\=4032804355&amp;scr_x\=0&amp;scr_y\=0&amp;eid\=44759876%2C44759927%2C44759837%2C42531398%2C44750773%2C31065469%2C31065635%2C31065653&amp;oid\=2&amp;pvsid\=3597566877081334&amp;pem\=842&amp;tmod\=1303053567&amp;nvt\=1&amp;ref\=https%3A%2F%2Fpattern-duchess\.com%2Fwp-admin%2Fpost\.php%3Fpost%3D8583%26action%3Dedit&amp;top\=https%3A%2F%2Fpattern-duchess\.com%2Fwp-admin%2Fpost\.php%3Fpost%3D8583%26action%3Delementor&amp;eae\=0&amp;fc\=1664&amp;brdim\=-1%2C25%2C-1%2C25%2C1440%2C25%2C1430%2C661%2C1150%2C581&amp;vis\=1&amp;rsz\=%7C%7CeE%7C&amp;abl\=CS&amp;pfx\=0&amp;fu\=132&amp;bc\=31&amp;ifi\=8&amp;uci\=8\.nchr8xclxsy9&amp;fsb\=1&amp;xpc\=irkyDIf3So&amp;p\=https%3A//pattern-duchess\.com&amp;dtd\=163$ /-dtd-163_ext_iframe/? permanent;
if ($args ~* ^s=\%7Bsearch_term_string\%7D$){ rewrite ^//?$ /s-{search_term_string}/? permanent; }
if ($args ~* ^ssp_iabi=1677506810155$){ rewrite ^/how-to-knit-organ-pleats/?$ /how-to-knit-organ-pleats/ssp_iabi-1677506810155/? 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
