WackoWiki: Request handling

https://wackowiki.org/doc     Version: 6 (04.09.2020 12:08)

Request handling

bugs:issue[link1] in bugtracker
Author: RideSnowNow[link2]

Introduction

1. Permalink
2. Link shortening
3. Seo Friendly Url
4. Canonical URLs

Request index.php?
  1. [page=][tag][handler][other parameters for actions, whatever]
  2. [page_id=][page_id]&[version_id]
  3. [hashid=][hashid]&[]

rewrite OFF
  1. ?page=WackoWiki
  2. ?page_id=5
  3. ?page_id=5&sef_tag=WackoWiki-Handbook-for-Beginners
  4. ?page_id=5&sef_tag=WackoWiki-Handbook-Quick-HowTo (not necessarily unique !)

rewrite ON
  1. WackoWiki
  2. ID/5
  3. ID/5/WackoWiki-Handbook-for-Beginners
  4. ID/5/WackoWiki-Handbook-Quick-HowTo (not necessarily unique !)

Implementation Notes


API Changes

Configuration

Implementation Log

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






Other Changes

Related Links

  1. Canonicalization[link4]
  2. Allowed Characters[link5]
  3. URL as UI[link6]

Future Ideas

Feedback