Skip to content

Instantly share code, notes, and snippets.

@geigel
Last active April 3, 2025 20:15
Show Gist options
  • Save geigel/804d7005dd587c6bd4fa565c41cc3f62 to your computer and use it in GitHub Desktop.
Save geigel/804d7005dd587c6bd4fa565c41cc3f62 to your computer and use it in GitHub Desktop.
Regular expression (regex) matching every page in a Wordpress site except for the homepage and pages related to the admin section (e.g. those under wp-admin/). Useful when redirecting to the homepage of a dead site that needs to still exist, but force all incoming traffic to the homepage to see some message.
^(?!\/(wp-admin\/|wp-login\.php|wp-register\.php)(\?|$)).+$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment