G
G
Gennady2018-02-04 00:18:04
linux
Gennady, 2018-02-04 00:18:04

How to redirect links like example.com/?p=1234 to 404 in Nginx?

Hello gentlemen. Can you please tell me how in Nginx to make it so that when visiting links like example.com/?p=1234 (and similar ones, not only 1234) in WordPress, a 404 error is returned?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alfss, 2018-02-05
@sferg1985

location / {
    if ( $arg_p ~ ^([0-9]+)$ ) { return 404; }
    ...
  }

something like this

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question