Regex help matching files in folders for status

I have this block and I’ve tried it a million ways, but the readme/changelog blocks never work.

I would like to block any readme.(html|md|txt) or changelog with same extension variants as 403.

here’s the latest attempt.

status 403 { /wp-config.php /wp-admin/install.php /wp-admin/includes/comment.php /wp-admin/network/menu.php /wp-admin/user/menu.php /wp-includes/admin-bar.php ~*((readme|changelog)\.(txt|html|md)) ~*readme.md ~*readme.html ~*changelog.html ~*changelog.md ~*changelog.txt }

I’m pulling my hair out at what should be easy –

It appears that the status block does not support regex yet?

Well, that stinks. :frowning:

See Deny access to to specific files - #4 by matt

You can cheat your way around that a little bit by using rewrites:

rewrite {
  r ^some-regex
  to /404
}

status 404 /404
2 Likes

Thanks to your reply on the other bad bot thread, I was able to piece that together. And, I even have a wordpress import file now… it’s running swimmingly.

Thanks for your help to me!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.