diff --git "a/docs/20_\342\226\266\357\270\217_Installation.md" "b/docs/20_\342\226\266\357\270\217_Installation.md" index 8b227806f3b0630a44f3c7dd5f332da6eb8ce6ca..37b0e1ab2e027512d75931467406b3b74d0284ca 100644 --- "a/docs/20_\342\226\266\357\270\217_Installation.md" +++ "b/docs/20_\342\226\266\357\270\217_Installation.md" @@ -1,6 +1,6 @@ -# Installation # +## Installation -## Get the files ## +### Get the files The repository contains a subfolder *public_html*. Run `git clone` or extract the downloaded archive 1 level above webroot. The document root of the web must point to the public_html directory. The config folder is outside the webroot. @@ -23,7 +23,7 @@ to the public_html directory. The config folder is outside the webroot. └── readme.md ``` -## Redirect all requests to index.php ## +### Redirect all requests to index.php Redirect all requests to the index.php. Activate the .htaccess or (better) add the config to the vhost config. diff --git "a/docs/30_\342\232\231\357\270\217_Configuration.md" "b/docs/30_\342\232\231\357\270\217_Configuration.md" index 210eab0d1092964479e78ad2678b79e6c07d61c2..9045a308fd74ee3c2befba62caf6be3faa0789a0 100644 --- "a/docs/30_\342\232\231\357\270\217_Configuration.md" +++ "b/docs/30_\342\232\231\357\270\217_Configuration.md" @@ -1,12 +1,13 @@ +## Configuration -# Configuration # +### Files In the *./config/* folder are json files. Copy the dist files to the same filename without ".dist" -* redirects_[FQDN].json - -* aliases.json - +* `redirects_<FQDN>.json` - Config with redirects per domain +* `aliases.json` - list of domain aliases -You can create multipe redirect files `redirects_[FQDN].json`. We suggest to use the main domain as FQDN. +You can create multipe redirect files `redirects_<FQDN>.json`. We suggest to use the main domain as FQDN. If you have multiple domains that should use exactly the same redirects then use the `aliases.json`. Other requirements: @@ -14,7 +15,23 @@ Other requirements: * In the DNS you must point each domain to the redirect website. * In the apache web with multiple vhosts: add the need a server alias to process the hostname in the wanted vhost -## Redirects ## +### Redirects + +Let's start with an example for a `redirects_<FQDN>.json`: + +```json +{ + "direct":{ + "/heise": {"code": 307, "target": "https://www.heise.de" } + }, + + "regex":{ + "^/$": {"code": 307, "target": "https://www.iml.unibe.ch" }, + "^/ax.l.*": {"code": 307, "target": "https://www.axel-hahn.de" }, + ".*": {"code": 301, "target": "https://www2.example.com" } + } +} +``` There are 2 required sections to define redirects: @@ -30,9 +47,21 @@ first matching regex. If no rule matches a 404 will be shown. +#### Section "direct" + +This section has keys für direct matches to a webservice like location as string eg. "/mail". +This entry will match for a request to location /mail only - but not /mail2. + +#### Section "regex" + +This section has keys für direct matches to a webservice like location as regex eg. "^/mail" +This entry will match for a request to all locations starting with /mail: /mail and /mail2 as well. Use the dollar sign to define + Hint: if you set regex ".*" as last entry it works as a catchall for unmatched requests and you can define a default redirect target instead of showing a 404. +#### Define redirect + Both redirect section contain a redirect definition * code - http status code for redirection @@ -50,22 +79,7 @@ Suggestion for redirection lifecycle: * if the redirect has finished its life, switch the code to 308 or 301. * remove the redirect (which results into 404) -Example: - -```json -{ - "direct":{ - "heise": {"code": 307, "target": "https://www.heise.de" } - }, - - "regex":{ - "^$": {"code": 307, "target": "https://www.iml.unibe.ch" }, - "^ax.l.*": {"code": 307, "target": "https://www.axel-hahn.de" } - } -} -``` - -## Server aliases ## +### Server aliases If you have multiple domains with the same rules you can define aliases. @@ -78,8 +92,8 @@ Example: } ``` -The key is the name of the alias. The value is a domain for that was written a -redirect_[hostname].json already. +The key is the name of the alias. The value is a domain for that was a written +`redirect_<FQDN>.json` already. The existance of a redirect config has higher priority than an entry in the aliases config.