# Getting relative urls in Kirby 2.5

**URL:** <https://forum.getkirby.com/t/getting-relative-urls-in-kirby-2-5/7772>\
**Category:** Questions\
**Tags:** v2\
**Created:** [June 20, 2017, 11:01pm UTC](https://forum.getkirby.com/t/getting-relative-urls-in-kirby-2-5/7772 "2017-06-20T23:01:49Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![max](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/max/32/129_2.png) [@max](https://forum.getkirby.com/u/max)\
**Post date:** [June 20, 2017, 11:01pm UTC](https://forum.getkirby.com/t/getting-relative-urls-in-kirby-2-5/7772/1 "2017-06-20T23:01:49Z")

</div>

After upgrading a site to 2.5.0 I’m getting relative URLs for all page links and assets.  
The site is fine on my local environment, the issue is only happening on my server (webfaction hosting). Here is the starterkit running on the server with the issue:

[http://kirby.krypod.com/](http://kirby.krypod.com/)

any clues what might cause this?

---

<div class="post-metadata">

**Author:** ![max](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/max/32/129_2.png) [@max](https://forum.getkirby.com/u/max)\
**Post date:** [June 20, 2017, 11:04pm UTC](https://forum.getkirby.com/t/getting-relative-urls-in-kirby-2-5/7772/2 "2017-06-20T23:04:48Z")

</div>

I’m able to fix this by setting the base URL in the config.php

```
c::set('url','http://example.com/');

```

but still curious if it’s a bug in 2.5.0 or a setting on the server

---

<div class="post-metadata">

**Author:** ![flokuek](https://avatars.discourse-cdn.com/v4/letter/f/dfb087/32.png) [@flokuek](https://forum.getkirby.com/u/flokuek)\
**Post date:** [June 21, 2017, 4:19am UTC](https://forum.getkirby.com/t/getting-relative-urls-in-kirby-2-5/7772/3 "2017-06-21T04:19:31Z")

</div>

I got the same problem after updating my test enviroment… seems to be bug 😉

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [June 21, 2017, 8:27am UTC](https://forum.getkirby.com/t/getting-relative-urls-in-kirby-2-5/7772/4 "2017-06-21T08:27:57Z")

</div>

See this issue on GitHub: [https://github.com/getkirby/kirby/issues/588](https://github.com/getkirby/kirby/issues/588)

I can’t reproduce this locally, haven’t tested on a remote server yet.

---

<div class="post-metadata">

**Author:** ![polysk](https://avatars.discourse-cdn.com/v4/letter/p/ec9cab/32.png) [@polysk](https://forum.getkirby.com/u/polysk)\
**Post date:** [June 21, 2017, 8:59am UTC](https://forum.getkirby.com/t/getting-relative-urls-in-kirby-2-5/7772/5 "2017-06-21T08:59:53Z")

</div>

Something seems to be wrong with 2.5.

I’ve used the Kirby 2.5 Plainkit to create a new setup (in a subfolder). The RewriteBase does not seem to be working - even though this was not required in other similar setups - and this is causing a problem when using the css & js functions to load assets.

---

<div class="post-metadata">

**Author:** ![jenstornell](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jenstornell/32/546_2.png) [@jenstornell](https://forum.getkirby.com/u/jenstornell)\
**Post date:** [June 21, 2017, 9:04am UTC](https://forum.getkirby.com/t/getting-relative-urls-in-kirby-2-5/7772/6 "2017-06-21T09:04:07Z")

</div>

**I really hope it’s a bug.** I’ve not yet tested 2.5 but there are a few reasons why relative urls should not be used:

> **[Why relative URLs should be forbidden for web developers • Yoast](https://yoast.com/dev-blog/relative-urls-issues/)**
>
> Many web developers still use relative urls in their CMS. A relative url is a url that is not complete. Usually it’s just the last part (the path) of a url, which means the domain name is left out. It’s often used by web developers, because it comes...

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [June 21, 2017, 9:08am UTC](https://forum.getkirby.com/t/getting-relative-urls-in-kirby-2-5/7772/7 "2017-06-21T09:08:44Z")

</div>

This is certainly not intended behavior…

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [June 21, 2017, 9:35am UTC](https://forum.getkirby.com/t/getting-relative-urls-in-kirby-2-5/7772/8 "2017-06-21T09:35:25Z")

</div>

Hm, I just did a test with a [fresh 2.5.0 Starterkit on a remote server](http://kirby.texnixe.io) and I don’t get this behavior, so I wonder what might be causing this for you.

---

<div class="post-metadata">

**Author:** ![ola](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ola/32/3465_2.png) [@ola](https://forum.getkirby.com/u/ola)\
**Post date:** [June 21, 2017, 12:09pm UTC](https://forum.getkirby.com/t/getting-relative-urls-in-kirby-2-5/7772/9 "2017-06-21T12:09:01Z")

</div>

That’s weird. I have installed a fresh 2.5.0 Starterkit on two different computers, and in both installations, `$page->url()` outputs relative urls.

I have only tried this locally, not on a remote server. Locally, I have tested both with a localhost adress, and a custom domain using Mamp Pro.

---

<div class="post-metadata">

**Author:** ![jenstornell](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jenstornell/32/546_2.png) [@jenstornell](https://forum.getkirby.com/u/jenstornell)\
**Post date:** [June 21, 2017, 12:27pm UTC](https://forum.getkirby.com/t/getting-relative-urls-in-kirby-2-5/7772/10 "2017-06-21T12:27:56Z")

</div>

I tested it on my localhost now and the it worked for me. I use PHP7. My [Engineer field](https://github.com/jenstornell/field-engineer) seems to be broken with 2.5, but that’s another story… ( **update:** it seems to be a bug in the toggle field [#1063](https://github.com/getkirby/panel/issues/1063))

---

<div class="post-metadata">

**Author:** ![Swissendo](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/swissendo/32/9528_2.png) [@Swissendo](https://forum.getkirby.com/u/Swissendo)\
**Post date:** [June 21, 2017, 2:13pm UTC](https://forum.getkirby.com/t/getting-relative-urls-in-kirby-2-5/7772/11 "2017-06-21T14:13:36Z")

</div>

I’ve upgraded to 2.5.0 via the Kirby CLI, and the same problem appeared for me. `$page->url()` only outputs `https://screenshots/noctuelles` for example, and the [Kirby TinyURL field](https://github.com/Thiousi/kirby-tinyurl-field/) only displays URLs like `/s/1cg4l3x` as well.

---

<div class="post-metadata">

**Author:** ![jenstornell](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jenstornell/32/546_2.png) [@jenstornell](https://forum.getkirby.com/u/jenstornell)\
**Post date:** [June 21, 2017, 2:47pm UTC](https://forum.getkirby.com/t/getting-relative-urls-in-kirby-2-5/7772/12 "2017-06-21T14:47:41Z")

</div>

It’s strange that different people get different results. I get the full url with this field.

![](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/a/af36f7a573a3d715710036f2f8d81f8a93182c20.png)

---

<div class="post-metadata">

**Author:** ![Swissendo](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/swissendo/32/9528_2.png) [@Swissendo](https://forum.getkirby.com/u/Swissendo)\
**Post date:** [June 21, 2017, 3:38pm UTC](https://forum.getkirby.com/t/getting-relative-urls-in-kirby-2-5/7772/13 "2017-06-21T15:38:54Z")

</div>

[https://i.swissendo.com/LrUNP.png](https://i.swissendo.com/LrUNP.png)  
Quite strange.

---

<div class="post-metadata">

**Author:** ![anon77445132](https://avatars.discourse-cdn.com/v4/letter/a/4da419/32.png) [@anon77445132](https://forum.getkirby.com/u/anon77445132)\
**Post date:** [June 21, 2017, 3:58pm UTC](https://forum.getkirby.com/t/getting-relative-urls-in-kirby-2-5/7772/14 "2017-06-21T15:58:23Z")

</div>

I have tested it local with XAMPP 7.0.13 and XAMPP 5.6.12 on Win10 (XAMPP version number = PHP version), I installed the starterkit in a subdirectory of the html root (e.g. at `E:\xampp_7.0.13\htdocs\kirby_2.5.0\` ), running at a special port (e.g. `http://127.0.0.1:61713/kirby_2.5.0/`) or at port 80 and have no problems.

So I am sure, your system is different.

Do you have the **unchanged** file `.htaccess` from Kirby in the root of your Kirby installation?  
If you have made some changes, please tell us the difference.

Did you change or add anything in the file `/site/config/config.php`?

Have you checked the permissions and the groups of the Kirby files and directories on your webserver after copying/installing the new Kirby version?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [June 21, 2017, 4:11pm UTC](https://forum.getkirby.com/t/getting-relative-urls-in-kirby-2-5/7772/15 "2017-06-21T16:11:45Z")

</div>

@ola: As you have experienced this on Mamp pro, could you let me know your Mamp settings to reproduce this? Type of server, PHP version etc.

---

<div class="post-metadata">

**Author:** ![ola](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ola/32/3465_2.png) [@ola](https://forum.getkirby.com/u/ola)\
**Post date:** [June 21, 2017, 4:30pm UTC](https://forum.getkirby.com/t/getting-relative-urls-in-kirby-2-5/7772/16 "2017-06-21T16:30:07Z")

</div>

Sure. Here is my setup:

A Mac running OS X 10.12.4.  
Mamp Pro v4.1  
PHP version 7.1.0 (has also tried with v7.0.13 and v5.6.28)  
Apache port 80

I have tried running a fresh installation of the starterkit both with the localhost domain name, and a custom host name e.g. `kirby.dev`.

I have not touched any other settings in Mamp than these.

I have tried the starterkit both on my work machine and my mac at home with the same results.

I have not tried Kirby 2.5 on a remote server, only locally with Mamp Pro.

---

<div class="post-metadata">

**Author:** ![ola](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ola/32/3465_2.png) [@ola](https://forum.getkirby.com/u/ola)\
**Post date:** [June 21, 2017, 4:34pm UTC](https://forum.getkirby.com/t/getting-relative-urls-in-kirby-2-5/7772/17 "2017-06-21T16:34:52Z")

</div>

@texnixe Here is a screenshot as a proof:

![](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/e/e8a1ecfcd2fd8e839acaf1cdf7b3d84bf9467910.png)

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [June 21, 2017, 4:40pm UTC](https://forum.getkirby.com/t/getting-relative-urls-in-kirby-2-5/7772/18 "2017-06-21T16:40:19Z")

</div>

Ok, so we have almost identical settings, my OS is 10.12.5, Mamp Pro 4.1.1 with Apache and PHP 7.1.0 and I tried with both localhost and custom kirby.dev domain, links work as they should:

![](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/1/15a45bf1b47347f81414a830d01d70ffe95e0031.png)

This is crazy…

---

<div class="post-metadata">

**Author:** ![anon77445132](https://avatars.discourse-cdn.com/v4/letter/a/4da419/32.png) [@anon77445132](https://forum.getkirby.com/u/anon77445132)\
**Post date:** [June 21, 2017, 4:41pm UTC](https://forum.getkirby.com/t/getting-relative-urls-in-kirby-2-5/7772/19 "2017-06-21T16:41:25Z")

</div>

Do you have a file `.htaccess` in the root of your Kirby installation?

---

<div class="post-metadata">

**Author:** ![ola](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ola/32/3465_2.png) [@ola](https://forum.getkirby.com/u/ola)\
**Post date:** [June 21, 2017, 4:42pm UTC](https://forum.getkirby.com/t/getting-relative-urls-in-kirby-2-5/7772/20 "2017-06-21T16:42:19Z")

</div>

Yes the .htaccess file from the starterkit is in the root of the Kirby installation.

[Next page](https://forum.getkirby.com/t/getting-relative-urls-in-kirby-2-5/7772.md?page=2)
