1

The web servers I managed are all running Apache 2.4 with Modsec. Is it possible to write a rule that will serve up a different page if matched by Modsec? I want this to be independent of the domain.

For example, if domain1.com/login or domain2.com/login redirect to domain3.com.

dstana
  • 285
  • 1
  • 10

1 Answers1

1

Yes you can, use the redirect action.

For example:

SecRule REQUEST_URI "/login" "phase:1,id:52,status:302,redirect:https://domain3.com

Though if doing a straight redirect like above you’d be better doing this in Apache.

Barry Pollard
  • 4,461
  • 14
  • 26
  • This looks like it will work. How would you accomplish this with Apache? It needs to cover the whole server, some of them have thousands of sites on them. – dstana Dec 17 '18 at 22:24
  • Don’t understand why that would be an issue. You could rewrite URLs using mod_alias’s `redirect` or `redirectMatch` (https://httpd.apache.org/docs/2.4/mod/mod_alias.html) or for more complicated rules use mod_rewrite (https://httpd.apache.org/docs/2.4/mod/mod_rewrite.html). – Barry Pollard Dec 17 '18 at 22:31