For our site's server block in nginx, I have these location directives:
location ~* ^.+\.(ico|css|js|eot|woff|otf|svg|gif|jpe?g|png|swg|woff2)(\?[a-z0-9=_]+)?$
location /applications/
location /
location ~ \.php$
I have a specific URL from our old forum software that I want to redirect. The URL looks like this:
https://www.example.com/forums/forumdisplay.php?f=105
So far, nothing I've tried seems to match this URL. I have tried a few different rewrite statements in the / location and I've also tried an exact match thinking that the longest match should win:
location = /forums/forumdisplay.php?f=105 { return 301 https://newurl; } This doesn't work - I still get a 404 from this URL. Where/how should I do this redirect?
?f=105is not part of the normalised URI used to matchlocationstatements. Try:if ($request_uri = "/forums/forumdisplay.php?f=105") { return 301 https://newurl; }