Suggestion

cases

  1. mode_rewrite OFF (default)
  2. mode_rewrite ON

Step 1


mod_rewrite places all stuff into page= and all other routing will be done by http class


.htaccess is static

Step 2


rules be written in config/router.conf as our own mod_rewrite-like


config->standard_handlers will be loaded dynamically by glob'ing handler/page/*.php files


additional cases can be configured as follows (admin.php, index.php, robots.txt, sitemap.xml, favicon.ico) but were used only for reserved words testing on page creation.


additionally it will be not allowed to use any of these predefined reserved words:

  1. 12345
  2. 12345rev12
  3. HASHID

(maybe configured too)


then - incoming router:
there can be multiple rules, all prefixes can be checked and processed, all SEO tails can be configured to be discarded on arrival, etc


 
'#^[0-9a-z]+$#i				hashid=$0 redirect'
'#^([0-9]+)rev([0-9]+)$#		id=$1 version=$2 redirect'
'#^([0-9]+)$#				id=$1 redirect'
'#^(.+?)/rev([0-9]+)/{method}(/.*)?$#	page=$1 version=$2 method=$3'
'#^(.+?)/{method}(/.*)?$#		page=$1 method=$2 version=?version_id'    // from _GET
'#^(.+?):seo-.*$#			page=$1 '
'default				page=$0 create'	

default: method=show version=latest


other possibilities:


hashid= / page_id= / page= quasi-assignments is a check-it rules also
- so if $0 is not hashid, or if $1 is not a page
- if the rule fails, then search continues
- if none found - 404, but only default rule will give "wanna create?" possibility


http class will need to search for pages by itself to process the router


redirect will redirect to canonical form URL, which I propose to be PAGE[/revVERSION][/METHOD]
(older revisions will be set as noindex/nofollow) but it can be made configurable


generation of permalinks - is done by {{action}} and can be generated any possible way


seems like it covers ALL possible cases, prefixes or not, can be extended then too