1

Plesk allows adding "Additional nginx directives" for hosted websites.

Plesk - Additional nginx directives

I'm trying to use this to set a 410 header on some old directories, but I can't find anything as simple as RewriteRule ^rss/ - [G] was in .htaccess rules. I've seen location /rss/ { return 410; } suggested but that doesn't work.

Is there a simple nginx directive to 410 a whole directory in Plesk?

  • Have you seen this related question on ServerFault? return error 410 for location regex? in nginx – Stephen Ostermiller Apr 4 '16 at 18:01
  • No joy there either; that's more query-specific. – Andrew Lott Apr 5 '16 at 10:15
  • One thing I would try would be taking off the trailing slash: location /rss { return 410; } I have a hunch that will do it based on the examples I've seen. – Stephen Ostermiller Apr 5 '16 at 10:43
  • I tried that too, but still no luck. – Andrew Lott Apr 5 '16 at 10:46
  • 1
    Another to try is location ^~ /rss {return 410; } Regex matches all get applied first, so this makes the rule get applied earlier in case it is other rules getting in the way. – Stephen Ostermiller Apr 5 '16 at 10:50
1

Use:

location ^~ /rss {
    return 410;
} 

Regex matches all get applied earlier than other rules, so this makes the rule get applied first. The problem may be that there is some other rule that is getting applied first.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.