Skip to content
Snippets Groups Projects
Commit 67721fd2 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

update docs

parent 11f2cf97
Branches
No related tags found
1 merge request!57512 php83 update
# 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 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. 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. ...@@ -23,7 +23,7 @@ to the public_html directory. The config folder is outside the webroot.
└── readme.md └── 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) Redirect all requests to the index.php. Activate the .htaccess or (better)
add the config to the vhost config. add the config to the vhost config.
......
## Configuration
# Configuration # ### Files
In the *./config/* folder are json files. Copy the dist files to the same filename without ".dist" In the *./config/* folder are json files. Copy the dist files to the same filename without ".dist"
* redirects_[FQDN].json - * `redirects_<FQDN>.json` - Config with redirects per domain
* aliases.json - * `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`. If you have multiple domains that should use exactly the same redirects then use the `aliases.json`.
Other requirements: Other requirements:
...@@ -14,7 +15,23 @@ Other requirements: ...@@ -14,7 +15,23 @@ Other requirements:
* In the DNS you must point each domain to the redirect website. * 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 * 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: There are 2 required sections to define redirects:
...@@ -30,9 +47,21 @@ first matching regex. ...@@ -30,9 +47,21 @@ first matching regex.
If no rule matches a 404 will be shown. 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 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. requests and you can define a default redirect target instead of showing a 404.
#### Define redirect
Both redirect section contain a redirect definition Both redirect section contain a redirect definition
* code - http status code for redirection * code - http status code for redirection
...@@ -50,22 +79,7 @@ Suggestion for redirection lifecycle: ...@@ -50,22 +79,7 @@ Suggestion for redirection lifecycle:
* if the redirect has finished its life, switch the code to 308 or 301. * if the redirect has finished its life, switch the code to 308 or 301.
* remove the redirect (which results into 404) * remove the redirect (which results into 404)
Example: ### Server aliases
```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 ##
If you have multiple domains with the same rules you can define aliases. If you have multiple domains with the same rules you can define aliases.
...@@ -78,8 +92,8 @@ Example: ...@@ -78,8 +92,8 @@ Example:
} }
``` ```
The key is the name of the alias. The value is a domain for that was written a The key is the name of the alias. The value is a domain for that was a written
redirect_[hostname].json already. `redirect_<FQDN>.json` already.
The existance of a redirect config has higher priority than an entry in the The existance of a redirect config has higher priority than an entry in the
aliases config. aliases config.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment