Use domain for links to '/' to fix assets URLs on subdirectories
This commit is contained in:
parent
98b03d5c67
commit
f46e921b71
|
@ -4,7 +4,7 @@ namespace Engelsystem\Routing;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides urls when webserver rewriting is disabled.
|
* Provides urls when webserver rewriting is disabled.
|
||||||
*
|
*
|
||||||
* The urls have the form <app url>/index.php?p=<path>&<parameters>
|
* The urls have the form <app url>/index.php?p=<path>&<parameters>
|
||||||
*/
|
*/
|
||||||
class LegacyUrlGenerator extends UrlGenerator
|
class LegacyUrlGenerator extends UrlGenerator
|
||||||
|
@ -24,6 +24,7 @@ class LegacyUrlGenerator extends UrlGenerator
|
||||||
|
|
||||||
$uri = parent::linkTo('index.php', $parameters);
|
$uri = parent::linkTo('index.php', $parameters);
|
||||||
$uri = preg_replace('~(/index\.php)+~', '/index.php', $uri);
|
$uri = preg_replace('~(/index\.php)+~', '/index.php', $uri);
|
||||||
|
$uri = preg_replace('~(/index\.php)$~', '/', $uri);
|
||||||
|
|
||||||
return $uri;
|
return $uri;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
<title>%title% - Engelsystem</title>
|
<title>%title% - Engelsystem</title>
|
||||||
<meta charset="UTF-8"/>
|
<meta charset="UTF-8"/>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<link rel="stylesheet" type="text/css" href="assets/theme%theme%.css"/>
|
<link rel="stylesheet" type="text/css" href="%start_page_url%assets/theme%theme%.css"/>
|
||||||
<script type="text/javascript" src="assets/vendor.js"></script>
|
<script type="text/javascript" src="%start_page_url%assets/vendor.js"></script>
|
||||||
%atom_link%
|
%atom_link%
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -14,9 +14,9 @@ class LegacyUrlGeneratorTest extends TestCase
|
||||||
public function provideLinksTo()
|
public function provideLinksTo()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
['/', 'http://foo.bar/index.php', [], 'http://foo.bar/index.php'],
|
['/', 'http://foo.bar/index.php', [], 'http://foo.bar/'],
|
||||||
['/foo-path', 'http://foo.bar/index.php/index.php', [], 'http://foo.bar/index.php?p=foo_path'],
|
['/foo-path', 'http://foo.bar/index.php/index.php', [], 'http://foo.bar/index.php?p=foo_path'],
|
||||||
['/foo', 'http://foo.bar/index.php/index.php', [], 'http://foo.bar/index.php?p=foo'],
|
['/foo', 'http://foo.bar/index.php/index.php', [], 'http://foo.bar/index.php?p=foo'],
|
||||||
['foo', 'http://foo.bar/index.php', ['test' => 'abc'], 'http://foo.bar/index.php?p=foo&test=abc'],
|
['foo', 'http://foo.bar/index.php', ['test' => 'abc'], 'http://foo.bar/index.php?p=foo&test=abc'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ class UrlGeneratorTest extends TestCase
|
||||||
public function provideLinksTo()
|
public function provideLinksTo()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
['/', '/', 'http://foo.bar/', [], 'http://foo.bar/'],
|
||||||
['/foo/path', '/foo/path', 'http://foo.bar/foo/path', [], 'http://foo.bar/foo/path'],
|
['/foo/path', '/foo/path', 'http://foo.bar/foo/path', [], 'http://foo.bar/foo/path'],
|
||||||
['foo', '/foo', 'https://foo.bar/foo', [], 'https://foo.bar/foo'],
|
['foo', '/foo', 'https://foo.bar/foo', [], 'https://foo.bar/foo'],
|
||||||
['foo', '/foo', 'http://f.b/foo', ['test' => 'abc', 'bla' => 'foo'], 'http://f.b/foo?test=abc&bla=foo'],
|
['foo', '/foo', 'http://f.b/foo', ['test' => 'abc', 'bla' => 'foo'], 'http://f.b/foo?test=abc&bla=foo'],
|
||||||
|
|
Loading…
Reference in New Issue