Support using Shaarli without URL rewriting
- Shaarli can be fully used by prefixing any URL with /index.php/ - {$base_path} used in templates already works with this configuration - Assets path (outside of theme's assets) must be prefixed with {$root_url}/ - Documentation section in « Server configuration » Fixes #1590
This commit is contained in:
parent
ec45749187
commit
7f5250421b
10 changed files with 31 additions and 11 deletions
|
@ -174,10 +174,12 @@ protected function finalize(string $basePath): void
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$rootPath = preg_replace('#/index\.php$#', '', $basePath);
|
||||||
$this->assign('base_path', $basePath);
|
$this->assign('base_path', $basePath);
|
||||||
|
$this->assign('root_path', $rootPath);
|
||||||
$this->assign(
|
$this->assign(
|
||||||
'asset_path',
|
'asset_path',
|
||||||
$basePath . '/' .
|
$rootPath . '/' .
|
||||||
rtrim($this->conf->get('resource.raintpl_tpl', 'tpl'), '/') . '/' .
|
rtrim($this->conf->get('resource.raintpl_tpl', 'tpl'), '/') . '/' .
|
||||||
$this->conf->get('resource.theme', 'default')
|
$this->conf->get('resource.theme', 'default')
|
||||||
);
|
);
|
||||||
|
|
|
@ -362,7 +362,23 @@ sudo systemctl reload nginx
|
||||||
|
|
||||||
If Shaarli is hosted on a server behind a [reverse proxy](https://en.wikipedia.org/wiki/Reverse_proxy) (i.e. there is a proxy server between clients and the web server hosting Shaarli), configure it accordingly. See [Reverse proxy](Reverse-proxy.md) configuration.
|
If Shaarli is hosted on a server behind a [reverse proxy](https://en.wikipedia.org/wiki/Reverse_proxy) (i.e. there is a proxy server between clients and the web server hosting Shaarli), configure it accordingly. See [Reverse proxy](Reverse-proxy.md) configuration.
|
||||||
|
|
||||||
|
## Using Shaarli without URL rewriting
|
||||||
|
|
||||||
|
By default, Shaarli uses Slim framework's URL, which requires
|
||||||
|
URL rewriting.
|
||||||
|
|
||||||
|
If you can't use URL rewriting for any reason (not supported by
|
||||||
|
your web server, shared hosting, etc.), you *can* use Shaarli
|
||||||
|
without URL rewriting.
|
||||||
|
|
||||||
|
You just need to prefix your URL by `/index.php/`.
|
||||||
|
Example: instead of accessing `https://shaarli.mydomain.org/`,
|
||||||
|
use `https://shaarli.mydomain.org/index.php/`.
|
||||||
|
|
||||||
|
**Recommended:**
|
||||||
|
* after installation, in the configuration page, set your header link to `/index.php/`.
|
||||||
|
* in you `config.json.php` set `general.root_url` to
|
||||||
|
`https://shaarli.mydomain.org/index.php/`.
|
||||||
|
|
||||||
## Allow import of large browser bookmarks export
|
## Allow import of large browser bookmarks export
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,8 @@
|
||||||
function hook_archiveorg_render_linklist($data)
|
function hook_archiveorg_render_linklist($data)
|
||||||
{
|
{
|
||||||
$archive_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/archiveorg/archiveorg.html');
|
$archive_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/archiveorg/archiveorg.html');
|
||||||
$path = ($data['_BASE_PATH_'] ?? '') . '/' . PluginManager::$PLUGINS_PATH;
|
$rootPath = preg_replace('#/index\.php$#', '', $data['_BASE_PATH_'] ?? '');
|
||||||
|
$path = $rootPath . '/' . PluginManager::$PLUGINS_PATH;
|
||||||
|
|
||||||
foreach ($data['links'] as &$value) {
|
foreach ($data['links'] as &$value) {
|
||||||
$isNote = startsWith($value['real_url'], '/shaare/');
|
$isNote = startsWith($value['real_url'], '/shaare/');
|
||||||
|
|
|
@ -19,7 +19,8 @@ function hook_qrcode_render_linklist($data)
|
||||||
{
|
{
|
||||||
$qrcode_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/qrcode/qrcode.html');
|
$qrcode_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/qrcode/qrcode.html');
|
||||||
|
|
||||||
$path = ($data['_BASE_PATH_'] ?? '') . '/' . PluginManager::$PLUGINS_PATH;
|
$rootPath = preg_replace('#/index\.php$#', '', $data['_BASE_PATH_'] ?? '');
|
||||||
|
$path = $rootPath . '/' . PluginManager::$PLUGINS_PATH;
|
||||||
foreach ($data['links'] as &$value) {
|
foreach ($data['links'] as &$value) {
|
||||||
$qrcode = sprintf(
|
$qrcode = sprintf(
|
||||||
$qrcode_html,
|
$qrcode_html,
|
||||||
|
|
|
@ -76,7 +76,7 @@ <h3 class="window-subtitle">
|
||||||
</div>
|
</div>
|
||||||
{if="$thumbnails_enabled && !empty($link.thumbnail)"}
|
{if="$thumbnails_enabled && !empty($link.thumbnail)"}
|
||||||
<div class="daily-entry-thumbnail">
|
<div class="daily-entry-thumbnail">
|
||||||
<img data-src="{$link.thumbnail}#" class="b-lazy"
|
<img data-src="{$root_path}/{$link.thumbnail}#" class="b-lazy"
|
||||||
src=""
|
src=""
|
||||||
alt="thumbnail" width="{$thumbnails_width}" height="{$thumbnails_height}" />
|
alt="thumbnail" width="{$thumbnails_width}" height="{$thumbnails_height}" />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -12,10 +12,10 @@
|
||||||
<link type="text/css" rel="stylesheet" href="{$asset_path}/css/markdown.min.css?v={$version_hash}#" />
|
<link type="text/css" rel="stylesheet" href="{$asset_path}/css/markdown.min.css?v={$version_hash}#" />
|
||||||
{/if}
|
{/if}
|
||||||
{loop="$plugins_includes.css_files"}
|
{loop="$plugins_includes.css_files"}
|
||||||
<link type="text/css" rel="stylesheet" href="{$base_path}/{$value}?v={$version_hash}#"/>
|
<link type="text/css" rel="stylesheet" href="{$root_path}/{$value}?v={$version_hash}#"/>
|
||||||
{/loop}
|
{/loop}
|
||||||
{if="is_file('data/user.css')"}
|
{if="is_file('data/user.css')"}
|
||||||
<link type="text/css" rel="stylesheet" href="{$base_path}/data/user.css#" />
|
<link type="text/css" rel="stylesheet" href="{$root_path}/data/user.css#" />
|
||||||
{/if}
|
{/if}
|
||||||
<link rel="search" type="application/opensearchdescription+xml" href="{$base_path}/open-search#"
|
<link rel="search" type="application/opensearchdescription+xml" href="{$base_path}/open-search#"
|
||||||
title="Shaarli search - {$shaarlititle}" />
|
title="Shaarli search - {$shaarlititle}" />
|
||||||
|
|
|
@ -140,7 +140,7 @@
|
||||||
<div class="thumbnail">
|
<div class="thumbnail">
|
||||||
{ignore}RainTPL hack: put the 2 src on two different line to avoid path replace bug{/ignore}
|
{ignore}RainTPL hack: put the 2 src on two different line to avoid path replace bug{/ignore}
|
||||||
<a href="{$value.real_url}" aria-hidden="true" tabindex="-1">
|
<a href="{$value.real_url}" aria-hidden="true" tabindex="-1">
|
||||||
<img data-src="{$base_path}/{$value.thumbnail}#" class="b-lazy"
|
<img data-src="{$root_path}/{$value.thumbnail}#" class="b-lazy"
|
||||||
src=""
|
src=""
|
||||||
alt="" width="{$thumbnails_width}" height="{$thumbnails_height}" />
|
alt="" width="{$thumbnails_width}" height="{$thumbnails_height}" />
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
{/if}
|
{/if}
|
||||||
·
|
·
|
||||||
{'The personal, minimalist, super-fast, database free, bookmarking service'|t} {'by the Shaarli community'|t} ·
|
{'The personal, minimalist, super-fast, database free, bookmarking service'|t} {'by the Shaarli community'|t} ·
|
||||||
<a href="{$base_path}/doc/html/index.html" rel="nofollow">{'Documentation'|t}</a>
|
<a href="{$root_path}/doc/html/index.html" rel="nofollow">{'Documentation'|t}</a>
|
||||||
{loop="$plugins_footer.text"}
|
{loop="$plugins_footer.text"}
|
||||||
{$value}
|
{$value}
|
||||||
{/loop}
|
{/loop}
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
{/loop}
|
{/loop}
|
||||||
|
|
||||||
{loop="$plugins_footer.js_files"}
|
{loop="$plugins_footer.js_files"}
|
||||||
<script src="{$base_path}/{$value}#"></script>
|
<script src="{$root_path}/{$value}#"></script>
|
||||||
{/loop}
|
{/loop}
|
||||||
|
|
||||||
<div id="js-translations" class="hidden">
|
<div id="js-translations" class="hidden">
|
||||||
|
|
|
@ -31,7 +31,7 @@ <h2 class="window-title">{'Picture Wall'|t} - {$countPics} {'pics'|t}</h2>
|
||||||
{loop="$linksToDisplay"}
|
{loop="$linksToDisplay"}
|
||||||
<div class="picwall-pictureframe" role="listitem">
|
<div class="picwall-pictureframe" role="listitem">
|
||||||
{ignore}RainTPL hack: put the 2 src on two different line to avoid path replace bug{/ignore}
|
{ignore}RainTPL hack: put the 2 src on two different line to avoid path replace bug{/ignore}
|
||||||
<img data-src="{$value.thumbnail}#" class="b-lazy"
|
<img data-src="{$root_path}/{$value.thumbnail}#" class="b-lazy"
|
||||||
src=""
|
src=""
|
||||||
alt="" width="{$thumbnails_width}" height="{$thumbnails_height}" />
|
alt="" width="{$thumbnails_width}" height="{$thumbnails_height}" />
|
||||||
<a href="{$value.real_url}"><span class="info">{$value.title}</span></a>
|
<a href="{$value.real_url}"><span class="info">{$value.title}</span></a>
|
||||||
|
|
|
@ -117,7 +117,7 @@ <h3 class="window-subtitle">{'Disabled Plugins'|t}</h3>
|
||||||
|
|
||||||
<div class="center more">
|
<div class="center more">
|
||||||
{"More plugins available"|t}
|
{"More plugins available"|t}
|
||||||
<a href="doc/html/Community-&-Related-software/#third-party-plugins">{"in the documentation"|t}</a>.
|
<a href="{$root_path}/doc/html/Community-&-Related-software/#third-party-plugins">{"in the documentation"|t}</a>.
|
||||||
</div>
|
</div>
|
||||||
<div class="center">
|
<div class="center">
|
||||||
<input type="submit" value="{'Save'|t}" name="save">
|
<input type="submit" value="{'Save'|t}" name="save">
|
||||||
|
|
Loading…
Reference in a new issue