Exclude Pages and Files

The Exclude option in the Simply Static plugin allows you to prevent specific pages, posts, or files from being included in the static site export.

You’ll find it under:

Simply Static → Settings → General  → Exclude

There you can configure:

  1. URLs to exclude – a list of URLs or patterns that should never be exported.
  2. Content types – select post types (like pages or posts) to skip entirely.
  3. Pattern-based excludes – use keywords or regex patterns to exclude items that match certain criteria (for example, excluding anything in uploads ).

The most powerful part of this screen is the URLs to exclude list, which now supports regular expressions (regex) for advanced use cases.

Version note: Regex support for excludes is available in Simply Static 3.5.6+ (included with Simply Static Pro 2.0+). If you don’t see the behavior described below, update to the latest plugin versions.

Below is a screenshot showing the location of the exclude option:

Screenshot showing the location of the Exclude option in the Simply Static admin interface


URLs to exclude (with regex support)

In the URLs to exclude text input area, Simply Static treats each line as either:

  • a literal string (eg. normal/plain text), or
  • a regex pattern (advanced)

This allows you to mix simple “contains” rules with more complex patterns on the same screen.

How Simply Static decides “regex vs literal”

Simply Static considers a line to be a regex pattern only if:

  • it starts with / , and
  • it contains another /  later in the line (the closing delimiter).

Anything else is treated as a literal string.

Internally, Simply Static validates regex lines using PHP’s preg_match . If the pattern is invalid, it is quietly treated as a literal instead of throwing an error.

Regex format

  • Delimiter must be / .
  • Optional flags go after the closing / .

    Common flags:

    • i  – case-insensitive
    • m  – multi-line
    • s  – dot matches newlines
    • u  – UTF-8

Examples of regex lines:

  • /\/category\//  – match any URL that contains /category/
  • /\.(pdf|docx)$/i  – match URLs ending in .pdf  or .docx  (case-insensitive)
  • /\?replytocom=\d+$/i  – match ?replytocom=123  style comment URLs

How literals vs regex behave

Literal lines (simple “contains” rules)

If a line is not in /pattern/flags  form, it is treated as a literal.

  • The export URL is excluded if it contains that literal substring.
  • Matching is case-insensitive.
  • It is not an exact-match rule – as long as the literal appears anywhere in the URL, it will be excluded.

Examples (as literals):

wp-json /uploads/ ?preview=true  

These will exclude any URL that contains wp-json , /uploads/ , or ?preview=true  anywhere in the full URL.

Regex lines (advanced rules)

If a line starts with / and includes a closing /  plus optional flags, it is treated as a regex.

  • The regex runs against the full URL string (including scheme and domain).
  • If the regex matches, the URL is excluded.
  • Use anchors like ^  and $  when you want to be precise and limit unexpected matches.

Examples (as regex):

/\/wp-admin\//i /\/feed\/?$/i /^https?:\/\/example\.com\/private\//i  

These would exclude, respectively:

  • Any URL containing /wp-admin/  (case-insensitive).
  • Any URL ending with /feed  or /feed/ .
  • Any URL under https://example.com/private/ .

Practical examples

You can mix literals and regex patterns in the same list. For example:

wp-json /wp-admin/ /\?replytocom=\d+$/i /\/category\/(uncategorized|internal)\//i  

This will:

  • Exclude any URL that contains wp-json .
  • Exclude any URL that contains /wp-admin/  (as a literal).
  • Exclude comment reply URLs like ?replytocom=123 .
  • Exclude category URLs like /category/uncategorized/  and /category/internal/ .

Tips for writing reliable patterns

  • Start simple. If a complex regex doesn’t work, test a smaller version first.
  • Escape /  as \/ inside regex patterns.

    Anchor when you can to avoid accidental matches:

    • Good: /^https?:\/\/example\.com\/blog\/.*$/i
    • Risky: /blog/i  (might match URLs you didn’t intend)
  • Use a PHP/PCRE-compatible regex tester if you’re unsure about the syntax.

Troubleshooting

  • My regex line seems to be ignored
    • If the pattern is invalid, Simply Static will treat it as a literal instead of throwing an error.
    • Check that it’s wrapped like /.../  and that any /  characters inside the pattern are escaped as \/ .
  • I excluded wp-admin  but some URLs are still exported
    • Remember that literals are “contains” checks. If the URL doesn’t literally contain the string you used, it won’t match.
    • Try a regex like /\/wp-admin\//i  if you need more precision.