Page tree
Skip to end of metadata
Go to start of metadata

Reason

When a site switches to Newscoop from a different CMS (do not be shocked, those other CMS do exist), they may need to preserve connections to their old URLs. There may be bookmarks, links from (a)social networks, web analytics data, and whatever.

Approach

The proposed way consists of several distinct steps outlined below. See ticket CS-4144.

1) Redir modes

  • usage of the redir system woulkd be controlled at system preferences:
    not to use / load new content / redirect to new pages

2) Storage of rules

  • to store actual URIs redirections in a table, since it is more flexible, actual checking at a new plugin (Application_Plugin_Redirect)
  • to put optionally some 'leave this type of URI intact' into htaccess, to avoid clashes with our URI redirection rules

3) Matching types

  • start vs. whole URI, needs to be fast, indexable
  • one new URI for 0-to-N old URI forms

4) Rule import

  • To have a text file import since it should be easier for larger sites
  • May be a UI for editing particular rules

Initial request handling

  • Start
    request: host=example.net path=/legacy_dir/legacy_path?param_1=value_1
    if (ignore URI parameters): path=/legacy_dir/legacy_file
    
  • Initial checking
    if (legacy URI usage disabled): exit
    if (handled as image or at admin interface or ajax request): exit
    if (restrict to legacy host not empty):
        if (request host is not restricted legacy host): exit
    if (restrict to legacy prefix not empty):
        if (restricted prefix is not prefix of request path): exit
    

Rules

  • old host (optional): if set, restricts the rule on requests on that (old) host
  • old path (mandatory): path used for matching against request paths
  • match type (mandatory): exact / prefix / like
    exact - the old path and request path has to be equal
    prefix - the old path has to be a prefix of request path
    like - general string for the sql 'like' clause, meant just for exceptional cases
  • new host (optional): if set, the (new) host is set on matching requests
  • new path (mandatory): used as an effective URI path on matching requests

Note that database stores the match type as a boolean value for yes/no exact matching; and old path is stored either exactly if exact matching, or prepared for the like clause if prefix or like matching.

  • No labels