Craft CMS Stack Exchange is a question and answer site for administrators, end users, developers and designers for Craft CMS. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Say I have a custom field "URL" for each entry and I want them to be redirected to these specific URLs instead of Craft's.

Similar to WordPress "Page Links To" plugin.

Can I do this in Craft?

share|improve this question
Where do you list the links to these entries. Wouldn't it make sense to load the URL from that custom field into that list, instead of using 302 redirects? – carlcs Aug 21 '14 at 14:00
hey @carlcs, how do you mean? – Salles Aug 21 '14 at 14:10
What you're now doing is using a link <a href="entryUrl"... to link to that entry and then the visitor is redirected from that entry page to the URL you actually want him to see. My question is, why don't you use that URL in the actual link? – carlcs Aug 21 '14 at 14:13
@carlcs These URLs are gonna be submitted by users via a front end form, so not by me actually ;) – Salles Aug 21 '14 at 14:29
Yeah, but that makes no difference. – carlcs Aug 21 '14 at 14:38

Instead of using a redirect, what about using the saved URLs directly with your links?

Let's say it's a channel with the handle myExternalLinks where you collect the links. The actual URL is entered into a field with the handle myLinkUrl.

This is the template code to list the links:

{% set links = craft.entries.section('myExternalLinks') %}

{% for link in links %}

     # Link to the URL entered into `myLinkUrl` instead of
     # linking to `entry.getUrl()` and then using a redirect on that entry template
    <a href="{{ link.myLinkUrl }}">{{ link.title }}</a>

{% endfor %}
share|improve this answer
Ah it just hit me, you're right. They way I was doing was dumb :) Thanks @carlcs! – Salles Aug 21 '14 at 15:03

Use this redirect tag in the template of your entries. Without any plugin! :)

{% redirect entry.myUrlFieldName %}
share|improve this answer
Hey @carlcs, maybe I haven't been clear enough... this will redirect all entries to the same URL? – Salles Aug 21 '14 at 14:01
No. It'd redirect to the url entered into a custom field with the name myUrlFieldName, @Salles. – carlcs Aug 21 '14 at 14:02
Ok, thank you! :) – Salles Aug 21 '14 at 14:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.