Redirect from one ID to another

Hi there,

I have a section of pages, which I have duplicated, so that we can work on a new version.
I want to put this live now - but realised that I have links throughout the site which link to the ‘old’ section IDs.

So - old section has a list of pages with the IDs 10,11,12,13
and the new section has the same page URLs, but with the new IDs of 20,21,22,23.

I was hoping to do 301 redirects, but these work on the URL, which is the same as the old section.
is there a way to set up redirects so that if there is a link to [[~10]] (which will no longer exist), it will forward the user to [[~20]].

Thanks for any pointers!


Maybe instead of deleting the old pages, you could change them into Weblinks (with new aliases) that point to the new resources. Then set the system setting use_weblink_target to Yes so that the output of [[~10]] stays the same.

Maybe use the SEO Tab/Pro extra?

That what I thought originally, but you can only redirect urls - not ids. I think?!

The aliases are the same on old and new - do it’s fine for external users and google indexing - but other pages have links to ids which are now breaking.

In case there are only a few pages to redirect, you can also use Redirectoid Snippet in the old pages.

Ok haven’t seen that one. So presumably I’d need to I delete the old pages and hide them from menus.

You can give the old pages a different alias (you’ll need to do that regardless if new and old are published), and give that the new resource ID as the weblink target. Then your [[~10]] links in pages or templates will go to /some-page-old which then redirects to /some-page.

There’s also a setting, use_weblink_target, that you can enable. When that’s on, resource 10 is a weblink that points to resource 20, [[~10]] will immediately point to resource 20.

Perfect thanks mark - I hadn’t seen the 'use_weblink_target setting before - that’s perfect. Thank!

The solution you marked was already mentioned in the first response to your thread by @halftrainedharry :wink:

Oops - sorry about that. Have changed it! :smile:

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.