The Search 404 Module

https://www.drupal.org/project/search404

Credits & Thanks

Thank you to:

About the Search 404 Module

When a website visitor goes to a URL that doesn’t exist, the Search 404 module shows them alternative pages that might contain the content they are seeking. The module performs a search using the keywords in the missing URL to select appropriate content to show to the lost visitor.

For example, if a visitor goes to https://yourDrupal8site.dev/animals/cute-cats (which I assume doesn’t exist on your website) and finds nothing, then this module will search for “animals cute cats” and display those search results below the “404 Page Not Found” error.

This tweak to the 404 page helps your SEO by making sure that old or misspelled links to your site will still resolve to relevant content. It helps visitors find your content, and you want visitors to find the great content on your site. You especially want Google to be able to find related content if the indexed page has been removed.

Install and Enable the Search 404 Module

  1. Install the Search 404 module on your server. (Go here for more instructions on installing modules.)
     
  2. Go to the Extend page: Click Manage > Extend (Coffee: “extend”) or visit https://yourDrupal8site.dev/admin/modules in your browser.

    drupal 404 search module installation
     
  3. Select the checkbox next to “Search 404” and click the Install button at the bottom of the page.

There are no separate permissions required for the Search 404 module.

Configure the Search 404 module

  1. Go to the Search 404 module admin page by clicking Manage > Configuration > Search and metadata > Search 404 Settings (Coffee: “search404”) or visit https://yourDrupal8site.dev/admin/config/search/search404 in your browser.

    drupal 404 search module configuration screen
     
  2. Make sure the following check-boxes are selected:
     
    • “Jump directly to the search result when there is only one result”.
    • “Use a 301 Redirect instead of 302 Redirect”.
    • “Use auto-detection of keywords from search engine referrer”.
       
  3. Although there are many options on this page, you can leave most of them as you find them.
     
  4. Click the Save configuration button.

Now, try visiting a page on your site that you know does not exist, such as https://yourDrupal8site.dev/animals/cute-cats. You should see "Page not found" with the results of a search underneath it.

drupal 404 search module results page


 

Did you like this walkthrough? Please tell your friends about it!

twiter social icon linkedin social icon pinterest social icon