}
}
+ $rootPath = preg_replace('#/index\.php$#', '', $basePath);
$this->assign('base_path', $basePath);
+ $this->assign('root_path', $rootPath);
$this->assign(
'asset_path',
- $basePath . '/' .
+ $rootPath . '/' .
rtrim($this->conf->get('resource.raintpl_tpl', 'tpl'), '/') . '/' .
$this->conf->get('resource.theme', 'default')
);
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
function hook_archiveorg_render_linklist($data)
{
$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) {
$isNote = startsWith($value['real_url'], '/shaare/');
{
$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) {
$qrcode = sprintf(
$qrcode_html,
</div>
{if="$thumbnails_enabled && !empty($link.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=""
alt="thumbnail" width="{$thumbnails_width}" height="{$thumbnails_height}" />
</div>
<link type="text/css" rel="stylesheet" href="{$asset_path}/css/markdown.min.css?v={$version_hash}#" />
{/if}
{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}
{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}
<link rel="search" type="application/opensearchdescription+xml" href="{$base_path}/open-search#"
title="Shaarli search - {$shaarlititle}" />
<div class="thumbnail">
{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">
- <img data-src="{$base_path}/{$value.thumbnail}#" class="b-lazy"
+ <img data-src="{$root_path}/{$value.thumbnail}#" class="b-lazy"
src=""
alt="" width="{$thumbnails_width}" height="{$thumbnails_height}" />
</a>
{/if}
·
{'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"}
{$value}
{/loop}
{/loop}
{loop="$plugins_footer.js_files"}
- <script src="{$base_path}/{$value}#"></script>
+ <script src="{$root_path}/{$value}#"></script>
{/loop}
<div id="js-translations" class="hidden">
{loop="$linksToDisplay"}
<div class="picwall-pictureframe" role="listitem">
{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=""
alt="" width="{$thumbnails_width}" height="{$thumbnails_height}" />
<a href="{$value.real_url}"><span class="info">{$value.title}</span></a>
<div class="center more">
{"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 class="center">
<input type="submit" value="{'Save'|t}" name="save">