Does not include base path in searches

Created on 9 July 2025, 5 days ago

Problem/Motivation

If you have a site that uses a base path, e.g. Drupal root is "my-root", filtering does not work if you use the path from the browser. I.e.: /my-root/page1. This is especially a problem for exposed searches. Users expect to be able to use such urls.

This happens because the views_url_alias table doesn't include the base path.

Steps to reproduce

  1. Create a site with a base path, e.g. my-root
  2. Create a node with an alias of page1
  3. Create a view with Alias filtering
  4. Search for my-root/page1
  5. Get no results.
  6. Do get results for /page1

Proposed resolution

  • Add the base path via base_path() call to alias in views_url_alias_save
  • Add an update hook to rebuild the table

Remaining tasks

Have patch to add once issue is created

User interface changes

N/A

API changes

N/A

Data model changes

N/A

πŸ› Bug report
Status

Active

Version

3.1

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States cgmonroe

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

Comments & Activities

  • Issue created by @cgmonroe
  • πŸ‡ΊπŸ‡ΈUnited States cgmonroe

    Here is a patch against the 3.1.0 branch (dev based patch will not install on release branch)

  • πŸ‡¬πŸ‡§United Kingdom rachel_norfolk UK

    Heh - I’m slightly amused that it took me longer to remember how to make a test site with a base path than it did to actually test the proposed change!

    With the change applied, the test site correctly takes into account the base path. It also continues to work when there isn’t a base path.

    There is an update function to update aliases that might already be stored, which is also nice.

    I think this is a good one. RTBC

Production build 0.71.5 2024