# URL without "http://www."

**URL:** https://forum.getkirby.com/t/url-without-http-www/4663
**Category:** Questions
**Tags:** v2
**Created:** [July 11, 2016, 11:40am UTC](https://forum.getkirby.com/t/url-without-http-www/4663 "2016-07-11T11:40:21Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![jonathanhess](https://avatars.discourse-cdn.com/v4/letter/j/e99b99/32.png) [@jonathanhess](https://forum.getkirby.com/u/jonathanhess)
#### Post date: [July 11, 2016, 11:40am UTC](https://forum.getkirby.com/t/url-without-http-www/4663/1 "2016-07-11T11:40:21Z")

</div>

Hi,  
I just wondered if there is a kirby helper or something similar to output an URL without the [http://www](http://www). If I insert a link and output it as kirbytext, the links are formated like this.  
But I have a single field with type=url. So is this possible?  
Thanks

---

<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: [July 11, 2016, 11:52am UTC](https://forum.getkirby.com/t/url-without-http-www/4663/2 "2016-07-11T11:52:51Z")

</div>

I don’t know of any kirby helper, but you could use `preg_replace()` to remove the unwanted parts of the URL. Check out [this thread on SO](http://stackoverflow.com/questions/9364242/how-to-remove-http-www-and-slash-from-url-in-php) for some ideas.

---

<div class="post-metadata">

### Author: ![jonathanhess](https://avatars.discourse-cdn.com/v4/letter/j/e99b99/32.png) [@jonathanhess](https://forum.getkirby.com/u/jonathanhess)
#### Post date: [July 11, 2016, 11:58am UTC](https://forum.getkirby.com/t/url-without-http-www/4663/3 "2016-07-11T11:58:42Z")

</div>

Thanks for the short answer. I’m aware of the preg\_replace. I just thought there is maybe a native kirby way of doing this. Because it is also done with de link tag in kirbytext.

---

<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: [July 11, 2016, 12:01pm UTC](https://forum.getkirby.com/t/url-without-http-www/4663/4 "2016-07-11T12:01:55Z")

</div>

You can remove the protocol with `url::host($url)` but that would still leave you with the subdomain. Are you telling us that Kirby always adds www to an URL, even if you haven’t added it. Can you give an example of your content in your content file?

---

<div class="post-metadata">

### Author: ![jonathanhess](https://avatars.discourse-cdn.com/v4/letter/j/e99b99/32.png) [@jonathanhess](https://forum.getkirby.com/u/jonathanhess)
#### Post date: [July 11, 2016, 12:19pm UTC](https://forum.getkirby.com/t/url-without-http-www/4663/5 "2016-07-11T12:19:10Z")

</div>

No, my point was, that kirby removes the http and www in kirbytext formatted fields. If I enter:  
`(link: http://www.domain.com)`  
kirby outputs it like `domain.com`

Of course I could insert it without www. But the clients are used the www 😉

---

<div class="post-metadata">

### Author: ![jonathanhess](https://avatars.discourse-cdn.com/v4/letter/j/e99b99/32.png) [@jonathanhess](https://forum.getkirby.com/u/jonathanhess)
#### Post date: [July 11, 2016, 12:20pm UTC](https://forum.getkirby.com/t/url-without-http-www/4663/6 "2016-07-11T12:20:41Z")

</div>

But i solved it now with your suggested stack overflow solution. That works great.

---

<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: [July 11, 2016, 12:35pm UTC](https://forum.getkirby.com/t/url-without-http-www/4663/7 "2016-07-11T12:35:10Z")

</div>

Kirby uses `url::short($text)` to generate the text in the link tag. You could make a copy of the link tag and remove this behaviour. Does not help with the url field though.

---

<div class="post-metadata">

### Author: ![simon2017](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/simon2017/32/7442_2.png) [@simon2017](https://forum.getkirby.com/u/simon2017)
#### Post date: [July 11, 2016, 1:34pm UTC](https://forum.getkirby.com/t/url-without-http-www/4663/8 "2016-07-11T13:34:22Z")

</div>

I dont know if im Right or Wrong. But Like in Plesk, you can Select a Option For your Domain Like [http://www.example.de](http://www.example.de) or [www.example.de](http://www.example.de) or Just [example.de](http://example.de). it means you can Change the Option 🙂 to whatever you Like 🙂

---

<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: [July 11, 2016, 1:36pm UTC](https://forum.getkirby.com/t/url-without-http-www/4663/9 "2016-07-11T13:36:39Z")

</div>

@thesmithy: Yeah, but this has nothing to do with @jonathanhess’s problem. The link tag returns a short url, while the url field does not.

---

<div class="post-metadata">

### Author: ![simon2017](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/simon2017/32/7442_2.png) [@simon2017](https://forum.getkirby.com/u/simon2017)
#### Post date: [July 11, 2016, 1:39pm UTC](https://forum.getkirby.com/t/url-without-http-www/4663/10 "2016-07-11T13:39:15Z")

</div>

Okay i understand 🙂

---

<div class="post-metadata">

### Author: ![jonathanhess](https://avatars.discourse-cdn.com/v4/letter/j/e99b99/32.png) [@jonathanhess](https://forum.getkirby.com/u/jonathanhess)
#### Post date: [July 11, 2016, 1:53pm UTC](https://forum.getkirby.com/t/url-without-http-www/4663/11 "2016-07-11T13:53:26Z")

</div>

@texnixe: My goal is to get a shortlink without the subdomain ‘www’ and the ‘http://’ for the url field. So an url with the link tag and the url field are displayed the same way. I want to have consistency for all links.  
But as I said with the `preg_replace()` I got what I aimed for.

---

<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: [July 11, 2016, 1:55pm UTC](https://forum.getkirby.com/t/url-without-http-www/4663/12 "2016-07-11T13:55:14Z")

</div>

Ok, ok, now I finally fully understand. I have corrected it above.

---

<div class="post-metadata">

### Author: ![dennisb](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/dennisb/32/11676_2.png) [@dennisb](https://forum.getkirby.com/u/dennisb)
#### Post date: [June 18, 2018, 4:31pm UTC](https://forum.getkirby.com/t/url-without-http-www/4663/13 "2018-06-18T16:31:44Z")

</div>

is it possible to not shorten the link-text in a textarea-field?  
(link: [https://www.myurl.de](https://www.myurl.de) text: [https://www.myurl.de](https://www.myurl.de) popup: yes)  
i would like to show the complete url inclusive protocol…  
tnx

---

<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 18, 2018, 6:29pm UTC](https://forum.getkirby.com/t/url-without-http-www/4663/14 "2018-06-18T18:29:19Z")

</div>

As already mentioned above, you can make a copy of the Kirbytag and modify your version, overwriting the original link tag.

---

<div class="post-metadata">

### Author: ![dennisb](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/dennisb/32/11676_2.png) [@dennisb](https://forum.getkirby.com/u/dennisb)
#### Post date: [June 18, 2018, 9:56pm UTC](https://forum.getkirby.com/t/url-without-http-www/4663/15 "2018-06-18T21:56:53Z")

</div>

hmm, i don’t understand this behavior.

if i don’t like the protocol in the output, i don’t have to write it and i can set it up like  
(link: [https://www.myurl.de](https://www.myurl.de) text: [myurl.de](http://myurl.de))  
if i set the text to [https://www.myurl.de](https://www.myurl.de), i expect to get this as the result.

if i understand you, i can update the kirby/extensions/tags.php?  
but what will happen if i update kirby?  
is there a way to overwrite the tags.php outside?

however, i found a workaround that works for me (because in this case i have control over the content…)  
i use the html-special char for the slash: `&#47;`  
`(link: https://www.myurl.de text: https:&#47;&#47;www.myurl.de)`  
So the tag-extension doesn’t recognize the text as an url, and won’t shorten.

---

<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 18, 2018, 10:11pm UTC](https://forum.getkirby.com/t/url-without-http-www/4663/16 "2018-06-18T22:11:29Z")

</div>

What I meant is copy the tag into a new file and store in site/tags. That way, your tag will overwrite the default tag and your changes will still be in place if you update Kirby.

> [@dennisb](#):
>
> i use the html-special char for the slash: `&#47;`

Not very comfortable, I’d go for the modified tag.

---

<div class="post-metadata">

### Author: ![dennisb](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/dennisb/32/11676_2.png) [@dennisb](https://forum.getkirby.com/u/dennisb)
#### Post date: [June 18, 2018, 10:29pm UTC](https://forum.getkirby.com/t/url-without-http-www/4663/17 "2018-06-18T22:29:11Z")

</div>

> [@texnixe](#):
>
> store in site/tags

nice! didn’t know that.  
so now i also go with the modified tag and it works fine.  
tnx!

---

<div class="post-metadata">

### Author: ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)
#### Post date: [February 6, 2025, 5:27pm UTC](https://forum.getkirby.com/t/url-without-http-www/4663/18 "2025-02-06T17:27:57Z")

</div>


