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

# Specific redirections
if ($args ~* ^page_id=51$){ rewrite ^//?$ /page_id-51/? permanent; }
if ($args ~* ^wpccategories=$){ rewrite ^//?$ /wpccategories-/? permanent; }
if ($args ~* ^wpccategories=/table-decoration$){ rewrite ^//?$ /wpccategories-/table-decoration/? permanent; }
if ($args ~* ^wpccategories=/metal$){ rewrite ^//?$ /wpccategories-/metal/? permanent; }
if ($args ~* ^wpccategories=/urns$){ rewrite ^//?$ /wpccategories-/urns/? permanent; }
if ($args ~* ^wpccategories=/lighting$){ rewrite ^//?$ /wpccategories-/lighting/? permanent; }
if ($args ~* ^wpccategories=/furniture$){ rewrite ^//?$ /wpccategories-/furniture/? permanent; }
if ($args ~* ^wpccategories=/marquee$){ rewrite ^//?$ /wpccategories-/marquee/? permanent; }
if ($args ~* ^wpccategories=/finishing-touches$){ rewrite ^//?$ /wpccategories-/finishing-touches/? permanent; }
if ($args ~* ^wpccategories=/drapes$){ rewrite ^//?$ /wpccategories-/drapes/? permanent; }
if ($args ~* ^wpccategories=/entertainment$){ rewrite ^//?$ /wpccategories-/entertainment/? permanent; }
if ($args ~* ^s=fun\+ideas$){ rewrite ^/blog/?$ /blog/s-fun-ideas/? permanent; }
if ($args ~* ^s=personal\+touches$){ rewrite ^/blog/?$ /blog/s-personal-touches/? permanent; }
if ($args ~* ^s=fun\+ideas$){ rewrite ^/blog/category/something-different/?$ /blog/category/something-different/s-fun-ideas/? permanent; }
if ($args ~* ^s=personal\+touches$){ rewrite ^/blog/category/something-different/?$ /blog/category/something-different/s-personal-touches/? permanent; }
if ($args ~* ^p=37$){ rewrite ^//?$ /p-37/? permanent; }
rewrite ^/blog/trend-setting-wedding-chair-decor/products-and-serviecs-offered-by-wedding-planning-and-prop-hire-company-get-knotted-the-company-run-by-lindsey-hunter-from-her-base-in-the-scottish-borders-3$ /files/e-scottish-borders-3_xvhzmgzm33j0g5rw8zpfv0/? 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
