0

I am retiring a site and would like to display a message when anyone tries to access any page on the site EXCEPT for a couple of pages. Some pages have certain pageid parameters. So basically everything should redirect to /retired except for:

  • /testcode.jsp

  • /search/*

  • /codes/*

  • /resources/blogs/*

  • /status/*

  • /wiki/article?pageid=178973-ghgh-98089

  • /wiki/article?pageid=354973-aaaa-80879

  • /wiki/article?pageid=334224-sada-20293

  • /wiki/article?pageid=546665-qasq-34491

MrWhite
  • 13,315

1 Answers1

0

Looks like you want to make use of Apache's RewriteCond directive to conditionally redirect requests based on a pattern match, like so:

RewriteCond "%{REQUEST_URI}" "! /testcode.jsp" [OR]
RewriteCond "%{REQUEST_URI}" "! /search/*" [OR]
{ditto for your other requirements...}
RewriteRule .* /retired [R,L]

Which should explicitly allow anything in your regex pattern through, while redirecting everything else. See also, https://httpd.apache.org/docs/2.4/mod/mod_rewrite.html#rewritecond For more details.

Thomas N
  • 445
  • 2
  • 9