README.md
1# dokuwiki-plugin-404manager [![Build Status](https://travis-ci.org/gerardnico/dokuwiki-plugin-404manager.svg?branch=master)](https://travis-ci.org/gerardnico/dokuwiki-plugin-404manager)
2
3## About
4
5The [404 manager Dokuwiki plugin](https://www.dokuwiki.org/plugin:404manager) changes the behavior of Dokuwiki when a page doesn't exist.
6
7On a normal website, when a page doesn't exist, you get an [hard HTTP 404 response](https://en.wikipedia.org/wiki/HTTP_404), hence the name of the plugin.
8Dokuwiki returns a soft 404 with this simple message : 'This topic does not exist yet'.
9
10As you can see below on this snapshot:
11
12![The illustration](https://github.com/gerardnico/dokuwiki-plugin-404manager/blob/master/images/dokuwiki_200.jpg "Dokuwiki This topic does not exist yet")
13
14For the website readers, it's not really helpful and it can occur frequently when you use intensively the [plugin pagemove](https://www.dokuwiki.org/plugin:pagemove)
15in order to move page around. The most important problem is that thus external links become obsolete (especially for search engine for instance).
16
17## What can this plugin do ?
18
19### For writers
20 * Automatic redirection in edit mode
21 * A message is shown when the page name already exist in other pages.
22
23**Example:**
24
25![The page name check message](https://github.com/gerardnico/dokuwiki-plugin-404manager/blob/master/images/404manager_check_page_name_message.png)
26
27
28### For readers
29
30 * Redirection to a target page for a source page with the admin page
31 * Redirection by to the start page of the same namespace
32 * Redirection by best namespace
33 * Redirection to the internal search engine
34 * and of course Nothing.
35
36
37
38## Installation
39
40Install the plugin using:
41
42 * the [Plugin Manager](https://www.dokuwiki.org/plugin:plugin)
43 * [manually](https://www.dokuwiki.org/plugin:Plugins) with the [download URL](http://github.com/gerardnico/dokuwiki-plugin-minimap/zipball/master), which points to latest version of the plugin.
44
45on a server with minimal php 7.1
46
47## Configuration settings
48
49You can configure the 404 Manager Plugin in the Configuration settings admin page.
50
51![404manager configruation settings](https://github.com/gerardnico/dokuwiki-plugin-404manager/blob/master/images/dokuwiki_404manager_conf.jpg)
52
53You can :
54 * choose which action you want to perform for a reader (if the first action don't find any target page, the 404Manager plugin go to the second action, ...)
55 * set that a writer switch directly to the edit mode
56 * set if you want to check if the name page is unique
57 * set if you want to see the classic message. A classic message is a message that the user don't need to understand what happened. The 404 Manager have only one classic message and it's when a redirection to the edit mode occur for a writer)
58 * set the weight factor for the [Redirection by best namepage](#redirection-by-best-namepage)
59
60
61## Settings explained
62### Redirection by configuration (Admin Page)
63
64To go to the admin page, click on the admin button in the bottom of your page and click on the 404 Manager Plugin link.
65
66![404manager in the admin page](https://github.com/gerardnico/dokuwiki-plugin-404manager/blob/master/images/dokuwiki_404manager_adminpage_list.jpg)
67
68You will see the admin page for the 404 Manager Plugin. This page allow you to set up redirects to internal pages as external websites.
69
70![404manager plugin admin page](https://github.com/gerardnico/dokuwiki-plugin-404manager/blob/master/images/dokuwiki_404manager_adminpage.jpg)
71
72Action, you can perform :
73 * Add/Modify a redirect with the form Add/Modify
74 * Delete a redirect with the picture "delete"
75
76
77### Redirection by best name page
78
79The redirection by best name page is an simple algorithm which occurs to find the best page by name.
80
81It calculate a score for two kinds of page :
82
83 * the start pages of a namespace
84 * the pages with the same name
85
86A weight factor is applied and in this way, you can influence the redirection :
87
88 * When a page have the same name (by default 4)
89 * When a page is a start page of a namespace (by default 3)
90 * When a namespace match (by default 5)
91
92To change the default configuration, you must go to the [configuration settings](#configuration settings) page
93
94#### Example
95
96 * The page asked : namespace1:namespace2:pagename
97 * We have one page with the same name : namespace1:pagename
98 * We have one startpage : namespace1:namespace2:start
99
100**Score :**
101 * The score for the page with the same name is : 9 = 5 (because namespace1 is present in the asked page) + 4 (because the page name match)
102 * The score for the startpage is : 13 = 5 (because namespace1 is present in the asked page) + 5 (because namespace2 is present in the asked page) + 3 (because it's a start page)
103
104In this case, the startpage is the redirect page because it have a highest score (13 against 9)
105
106### Redirection by best namespace
107This redirection perform the same algorithm that the [redirection by best namepage](#Redirection by best namepage) but only for the start pages. If two start page for a namespace have the same score, the smallest start page is fired.
108
109**Ex:**
110 * asked page : namespace1:namespace3:namepage
111 * first start page : namespace1:namespace2:start (Score 5 = 2 for namespace1 + 3 for the startpage)
112 * second start page : namespace1:start (Score 5 = 2 for namespace1 + 3 for the startpage)
113We have the same score and the redirection occur on the smallest start page : first start page.
114
115### Redirection to the intern search engine
116The 404 Manager redirects to the search engine.
117
118The query performed is an explode of the page asked.
119
120#### Example
121
122 * The page asked : namespace1:namespace2:pre_pagename
123 * The query asked : namespace1+namespace2+pre+pagename
124
125
126## Data Store
127
128You can find the meta data:
129 * for the last version: in the Sqlite Database DOKUWIKI_HOME/data/meta/404manager.sqlite3
130 * for the older version: in the file 404managerRedirect.conf or 404managerRedirect.conf.migrated in the directory DOKUWIKI_HOME\lib\plugins\404manager
131
132With the SQLite plugin, the data can be queried directly through its admin page.
133
134## Language
135The plugin is only translated in English but you can translate it in your own language.
136
137Just copy the directory [lang/en](lang/en), rename it in your own language (For instance, for france, to lang/fr) and translate the files.
138