Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save benjaminblack/88a56be28e2ab87d1442 to your computer and use it in GitHub Desktop.
Save benjaminblack/88a56be28e2ab87d1442 to your computer and use it in GitHub Desktop.
Apache SSI (Server Side Includes) matching variables with regular expressions using the 'v' function
<!--#if expr="v('REQUEST_URI') =~ m#^/contact#" -->
<!--#set var="pathclass" value="contact" -->
<!--#elif expr="v('REQUEST_URI') =~ m#^/work#" -->
<!--#set var="pathclass" value="work" -->
<!--#elif expr="v('REQUEST_URI') =~ m#^/$#" -->
<!--#set var="pathclass" value="about" -->
<!--#endif -->
<html lang="en-US" class="<!--#echo var="pathclass" -->">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment