Reserved aliases - slackero/phpwcms GitHub Wiki

An alias is the human readable name that addresses a structure level, article, content part (news, guestbook, …) or file. It is used as index.php?<alias>, and as <alias>.html (or /alias/) once rewrite functionality is enabled. See URL handling for URL forms, rewrite configuration and 301/canonical behavior.

Some alias names are reserved because phpwcms uses them internally. An alias colliding with one of them is not rejected — phpwcms extends it with a suffix instead.

Reserved aliases

proof_alias() in include/inc_lib/backend.functions.inc.php blocks these names:

  • print
  • newsdetail
  • newspage
  • id
  • aid
  • subgallery
  • listpage
  • page
  • subscribe
  • unsubscribe
  • email
  • u
  • s
  • q
  • feedimport
  • r404
  • phpwcms-preview
  • dl
  • fmp
  • index
  • robots
  • sitemap
  • favicon

What happens on a collision

When an alias is empty or reserved, proof_alias() appends a suffix that depends on the type of thing being named:

Target Suffix
Structure level / article -view
Content part ("sub" content like news, guestbook) _ + date as _Ymd, e.g. news_20261013
File -<file id>, or -file when no ID is available

index is special: it is only suffixed when it is not the alias of the index page itself.

An alias is also checked against what already exists, and extended again when needed:

  • A physical file at <alias><rewrite_ext> in the document root adds -1, -2, … (unless the target is a file alias).
  • The same alias already used by a structure level, article or content part adds -01, -02, …; a file alias already in the file table gets -1, -2, … with the counter continuing from an existing numeric suffix.

Extending the list

Custom reserved aliases go into the config value $phpwcms['reserved_alias'] (shipped empty in include/config/dist.conf.inc.php):

// Block two additional aliases
$phpwcms['reserved_alias'] = array('myreserved-alias', 'blocked');

Notes

  • Aliases are lowercased and sanitized (uri_sanitize(), clean_slweg()); / is kept only when $phpwcms['alias_allow_slash'] is on and the target is not a file.
  • Alias length is capped at 230 characters.
  • Structure level and article aliases are unique across both tables — an alias used by a level is not available to an article, and vice versa.
  • With $phpwcms['allow_empty_alias'] enabled, an empty alias field stays empty instead of generating a value from the title or file name.

Related

  • URL handling — URL forms, rewriting, canonical links and the redirects admin
  • Core concepts — aliases in context of structure levels and articles
⚠️ **GitHub.com Fallback** ⚠️