views:

99

answers:

1

We just moved to a new site, and want to redirect old links where necessary - however, some still work. For instance,

/holidays/sku.html

still works, while

/holidays/christmas/

no longer works. I'd like to be able to allow the site to attempt to serve a page, and when a 404 is reached, THEN try to pass it through a series of regex redirects, that may look like:

location ~* /holidays/(.*)+$ { set $args ""; rewrite ^ /holidays.html?r=1 redirect; }

I'm using a ~* location directive instead of doing a direct rewrite because we're moving from a Windows-based ASPX site to Magento with php-fpm behind nginx, so we suddenly have to worry about case sensitivity.

Without using nested location directives (which are actively discouraged by nginx documentation) with an @handler of some sort, what's the best way to allow nginx to attempt to serve the page first, THEN pass it across redirects if it fails?

Thanks!