Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
redirect-handler
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IML Open Source
redirect-handler
Commits
2cf63d43
Commit
2cf63d43
authored
4 months ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Plain Diff
Merge branch '7728-handle-http-and-https-redirects' into 'master'
7728 handle http and https redirects See merge request
!8
parents
955fb3c2
b657e76f
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!8
7728 handle http and https redirects
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
docs/30_⚙️_Configuration.md
+4
-3
4 additions, 3 deletions
docs/30_⚙️_Configuration.md
public_html/admin/index.php
+5
-5
5 additions, 5 deletions
public_html/admin/index.php
public_html/classes/redirect.admin.class.php
+2
-2
2 additions, 2 deletions
public_html/classes/redirect.admin.class.php
with
11 additions
and
10 deletions
docs/30_⚙️_Configuration.md
+
4
−
3
View file @
2cf63d43
...
@@ -28,9 +28,9 @@ Let's start with an example for a `redirects_<FQDN>.json`:
...
@@ -28,9 +28,9 @@ Let's start with an example for a `redirects_<FQDN>.json`:
},
},
"regex"
:{
"regex"
:{
"^/$"
:
{
"code"
:
307
,
"target"
:
"https://www.iml.unibe.ch"
},
"^/$"
:
{
"code"
:
307
,
"target"
:
"https://www.iml.unibe.ch"
,
"link"
:
"/"
},
"^/ax.l.*"
:
{
"code"
:
307
,
"target"
:
"https://www.axel-hahn.de"
},
"^/ax.l.*"
:
{
"code"
:
307
,
"target"
:
"https://www.axel-hahn.de"
,
"link"
:
"/axelhahn"
},
".*"
:
{
"code"
:
301
,
"target"
:
"https://www2.example.com"
}
".*"
:
{
"code"
:
301
,
"target"
:
"https://www2.example.com"
,
"link"
:
"/testme"
}
}
}
}
}
```
```
...
@@ -72,6 +72,7 @@ Both redirect section contain a redirect definition
...
@@ -72,6 +72,7 @@ Both redirect section contain a redirect definition
*
code - http status code for redirection
*
code - http status code for redirection
*
target - target url of the redirect
*
target - target url of the redirect
*
link - optional, for regex only: set a path for a test link
Status codes
Status codes
...
...
This diff is collapsed.
Click to expand it.
public_html/admin/index.php
+
5
−
5
View file @
2cf63d43
...
@@ -24,7 +24,6 @@ $sHtml = '';
...
@@ -24,7 +24,6 @@ $sHtml = '';
$sErrors
=
''
;
$sErrors
=
''
;
$aIco
=
[
$aIco
=
[
'h2_err'
=>
'⚠️'
,
'h2_config'
=>
'🛠️'
,
'h2_config'
=>
'🛠️'
,
'h2_file'
=>
'📄'
,
'h2_file'
=>
'📄'
,
...
@@ -32,6 +31,8 @@ $aIco = [
...
@@ -32,6 +31,8 @@ $aIco = [
'ip_warn'
=>
'🟠'
,
'ip_warn'
=>
'🟠'
,
'ip_err'
=>
'❗'
,
'ip_err'
=>
'❗'
,
'error'
=>
'❗'
,
'type_config'
=>
'🔷'
,
'type_config'
=>
'🔷'
,
'type_alias'
=>
'▪️'
,
'type_alias'
=>
'▪️'
,
...
@@ -89,7 +90,7 @@ if (!$oR->isEnabled()) {
...
@@ -89,7 +90,7 @@ if (!$oR->isEnabled()) {
$sMyIp
=
gethostbyname
(
$_SERVER
[
'SERVER_NAME'
]);
$sMyIp
=
gethostbyname
(
$_SERVER
[
'SERVER_NAME'
]);
if
(
!
$sMyIp
)
{
if
(
!
$sMyIp
)
{
$sErrors
.
=
'<li>Ip address of current host ['
.
$_SERVER
[
'SERVER_NAME'
]
.
'] was not found.</li>'
;
$sErrors
.
=
'<li>
'
.
$aIco
[
'error'
]
.
'
Ip address of current host ['
.
$_SERVER
[
'SERVER_NAME'
]
.
'] was not found.</li>'
;
}
}
// ---------- GET CONFIG DATA
// ---------- GET CONFIG DATA
...
@@ -99,7 +100,7 @@ if (!$oR->isEnabled()) {
...
@@ -99,7 +100,7 @@ if (!$oR->isEnabled()) {
// ---------- SHOW ERRORS
// ---------- SHOW ERRORS
if
(
count
(
$aHosts
[
'_errors'
]))
{
if
(
count
(
$aHosts
[
'_errors'
]))
{
$sErrors
.
=
'<li>'
.
implode
(
'</li><li>'
,
$aHosts
[
'_errors'
])
.
'</li>'
;
$sErrors
.
=
'<li>'
.
$aIco
[
'error'
]
.
' '
.
implode
(
'</li><li>
'
.
$aIco
[
'error'
]
.
'
'
,
$aHosts
[
'_errors'
])
.
'</li>'
;
}
}
unset
(
$aHosts
[
'_errors'
]);
unset
(
$aHosts
[
'_errors'
]);
...
@@ -238,8 +239,7 @@ if (!$oR->isEnabled()) {
...
@@ -238,8 +239,7 @@ if (!$oR->isEnabled()) {
;
;
$sErrors
=
$sErrors
$sErrors
=
$sErrors
?
'<!-- <h2>'
.
$aIco
[
'h2_err'
]
.
' Found errors</h2> -->'
?
'<ol class="error">'
.
'<ol class="error">'
.
$sErrors
.
$sErrors
.
'</ol>'
.
'</ol>'
:
''
:
''
...
...
This diff is collapsed.
Click to expand it.
public_html/classes/redirect.admin.class.php
+
2
−
2
View file @
2cf63d43
...
@@ -141,8 +141,8 @@ class redirectadmin extends redirect
...
@@ -141,8 +141,8 @@ class redirectadmin extends redirect
$iHops
=
(
count
(
$aTmp
[
0
])
-
1
);
$iHops
=
(
count
(
$aTmp
[
0
])
-
1
);
$sReturn
=
(
$iHops
>
0
$sReturn
=
(
$iHops
>
0
?
'Found hops: <strong>'
.
$iHops
.
'</strong>'
?
'
<br>
Found hops: <strong>'
.
$iHops
.
'</strong>'
.
(
$iHops
>
1
?
' <span class="warning"> ⚠️ Verify your redirect to skip unneeded hops.</span>'
:
''
)
.
'<br><br>'
.
(
$iHops
>
1
?
'
<br>
<span class="warning"> ⚠️ Verify your redirect to skip unneeded hops.</span>'
:
''
)
.
'<br><br>'
:
''
:
''
)
.
$sReturn
)
.
$sReturn
;
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment