D7: Add node/[nid] redirects automatically

Created on 5 February 2023, almost 2 years ago
Updated 21 January 2024, 10 months ago

Problem/Motivation

Not sure this should be a feature request or bug.

In Drupal 8/9/10, there are redirects from /node/[nid] to the path/alias. In Drupal 7, these are not available out-of-the-box so the editors would need to either create these manually (unlikely to happen) or the site builder needs to enable the globalredirect module which is more likely and a best practice.

The globalredirect module doesn't actually create redirects for Quant to be able to pick up. It uses hook_init to do the redirects.

We could consider adding automatic redirects either 1) always or 2) if globalredirect is enabled. If we did the former, then the Drupal site could be inconsistent with the static site, so probably the latter makes more sense.

Steps to reproduce

  • Install Drupal 7
  • Enable and configure quant, quant_api, quant_redirect, redirect, and globalredirect modules
  • Use devel_generate to generate content
  • Change a node path to create a redirect
  • Go to /node/[nid] for that node and it should redirect you to the current alias
  • Go to Seed tab (/admin/config/services/quant/seed)
  • Check Export nodes, Export redirects and Trigger the batch
  • Click Save configuration button
  • Look at Quant Dashboard redirects
  • Result: There is no redirect for node/[nid] to redirect to the alias
  • Expected result: Redirect should be present and work
  • Proposed resolution

    Add code to do redirects for /node/[nid].

    Remaining tasks

    1. Update code
    2. Review and test
    3. Commit :)

    User interface changes

    API changes

    Data model changes

    ✨ Feature request
    Status

    Fixed

    Version

    1.0

    Component

    Code

    Created by

    πŸ‡ΊπŸ‡ΈUnited States Kristen Pol Santa Cruz, CA, USA

    Live updates comments and jobs are added and updated live.
    Sign in to follow issues

    Comments & Activities

    Production build 0.71.5 2024