About Page Path History (Core)

Keeps track of past URLs where pages have lived and automatically redirects (301 permament) to the new location whenever the past URL is accessed.

Category 1Admin Helpers
Admin helper modules are those that provide helpful tools, UI enhancements or optimizations to the admin panel (excluding Fieldtype or Inputfield modules).
Category 2SEO/Accessibility
Modules designed to help site accessibility, standards compliance and SEO.
Category 3Core Modules
Core modules are those already included with the ProcessWire core, but not necessarily installed. Most modules listed here can be installed by going to the modules screen and clicking "install" next to the module name.
Release StateStable
Should be safe for use in production environments. *
Authorryan
Module Version0.0.1
Class NamePagePathHistory
Compatibility2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 3.0
Date AddedJuly 31, 2012
Recommended ByNew recommendations may take up to 1 day to appear.

Details

With the Page Path History module you can move or rename any pages and all the old URLs will redirect to the new, automated behind the scenes, without any thinking on your part.

The Page Path History module keeps track of the previous URLs for any pages that have been moved or renamed. It then sets up automatic redirects (301, permanent) to ensure the old URLs redirect to the new ones. This is best demonstrated by a few examples:

  • Lets say you had the page /about/contact/ and you moved it to /contact/. With the Page Path History module installed, anyone accessing /about/contact/ will get redirected to /contact/.
  • You had a page called /our-products/ and you renamed it to be [/u]/products/. Any accesses to /our-products/ will now get redirected to /products/.
  • Lets say you had the page /our-products/furniture/eames-chair/ and you did like in the previous example and renamed /our-products/ to be /products/. The /our-products/furniture/eames-chair/ URL will now redirect to /products/furniture/eames-chair/ (and likewise for any other URLs under the /furniture/ structure).
  • Later on you decide to rename /products/ to just /inventory/. All the /our-products/ and /products/ URLs will continue to work with redirects.
  • You decide that eames-chair really belongs in /chairs/ rather than /inventory/, so you drag it to /chairs/eames-chair/. It's old URLs redirect to it's new URL.

Instructions

This module is already included with the ProcessWire core. To install, go to Admin > Modules > Page > Page Path History > and click install.

Comments

  • Carhu

    Carhu 4 years ago 00

    Seems sweet!

    One question:

    1. I move the page from /chairs/ to /plastic-chairs/. This page has children.

    2. I create a new page, /chairs/. This page will also have children, possibly with matching names to the previous parent, /chairs/chair-1/ etc.

    As the redirects are permanent, I assume they will override the real pages for those people who have visited the original page (and thus been redirected to the original page's new address) before I created the new page? This resulting in the "old visitors" ending up in the wrong place, for some time at least.

    Or am I missing something relevant? This might sound a bit far-fetched, but as for the people who don't really know what to take in consideration when you move a page this could potentially be a nasty situation.

    Cheers!

  • boundaryfunctions

    boundaryfunctions 2 years ago 00

    Hey Carhu,

    a bit late, but I'll still try to answer your question.

    The module is implemented like a fallback router complementing the default router (implemented in the core module ProcessPageView: https://github.com/ryancramerdesign/ProcessWire/blob/ccb1a190e7bb86e5/wire/modules/Process/ProcessPageView.module#L237). The PagePathHistory module is hooked before the function ProcessPageView::pageNotFound() (see: https://github.com/ryancramerdesign/ProcessWire/blob/ccb1a190e7bb86e5/wire/modules/PagePathHistory.module#L60), that is called only if the normal routing doesn't find a page that matches the requested URL. PagePathHistory then executes it's own routing (implemented in PagePathHistory::getPage(), https://github.com/ryancramerdesign/ProcessWire/blob/ccb1a190e7bb86e5/wire/modules/PagePathHistory.module#L149) based on the collected data, generated by moving pages.

    For your particular questions this means, that every time you change the URL of a page and afterwards create a new, page that matches the old URL, the newly created page will always be preferred to a redirection to an old page. This is because the PagePathHistory-Routing isn't even considered, if the normal routing can already come up with a valid page.

Post a Comment

Your e-mail is kept confidential and not included with your comment. Website is optional.