How to display a block on only the listed pages using wildcard and excluding subpages? I have a block I'm displaying using block setting's "Only the listed pages". I'm using a wild card asterisk to show the block on any pages following about-us/. For example: about-us/*

The problem is I ONLY want pages immediately after about-us/ to show.
For example about-us/faq would show the block but about-us/faq/content should NOT show the block.

I tried about-us/*/ but that had no effect.

Any suggestions?
Method 1. PHP filter

I think your question is partially answered here:

How to add page restrictions for blocks in drupal?

Only you might use this code:

&lt;?php
$arg = explode('/', drupal_get_path_alias());
if ($arg[0] == 'about-us' &amp;&amp; $arg[1] &amp;&amp; $arg[2] == NULL) {
  return TRUE;
}
else {
  return FALSE;
}
?&gt;


Method 2: Context module

Alternatively, you can try the Context module, which offers more robust visibility options. For instance, in addition to including paths you can prefix a path with a tilde "~" to exclude it.

I think this should do it:

about-us/*
~about-us/*/*


Edit: Added second method.

Edit: Using $_GET['q'] in method 1 instead of arg() (Thx, @leymannx!)