Drupal 7 Search 404 Module
Share with Others
The Drupal 7 Search 404 module is a handy module to use on Drupal websites with a lot of content or the possibility of broken links. It simply redirects any page not found requests to the search page and performs a search for those terms. It is an easy way to redirect traffic within your site if the site contains links to pages that no longer exist.
In this module you will learn:
- How to use the Drupal 7 Search404 module
- How to configure the Drupal 7 Search 404 module to 301 redirect to the first search result if the search only comes back with a single result
Hello there everyone, welcome to another Daily Dose of Drupal, we’re on Episode Number 64 today, as always I’m Shane, go ahead and follow me on Twitter @smthomas3 also go to codekarate.com and sign up for the newsletter if you haven’t already and find me on Google +.
Today we’re going over a very simple Drupal Module that can be extremely helpful especially on larger websites that has or if you have a lot of website and its Drupal based and it has a lot of content, this module could definitely come in handy.
The module is the Search 404 Module and what it does is it replaces the standard 404 page with a search for those terms. So as I said before; this is a simple module and you’ll basically turn it on and install it and it works out of the box.
So I already went ahead and download it and installed it, we’re going to go to the modules page and show you that it’s there and you can see the Search 404 Module, you cannot actually have been messing with the configurations so I reset back to the defaults here and as you can see there’s a whole bunch of options but before we look at the options let’s see what it does.
Let’s say I went ahead and I had a path that was Test/Article and maybe there was a link somewhere that was broken and Google index to that link or I sent that link out through Twitter or somehow there’s bad link got clicked on by a couple of people or someone somehow navigated to the site or this page or this URL that doesn’t exists.
So if I went ahead and try to go to this you can see it gives me a Page Not Found, it also lets me know that a search was performed for test article and as you can see I have two results for this so maybe I could click on this one and then I found what I was looking for.
So it helps with typos and URL’s or anything like that, it also make sure that instead of someone just seeing a Page Not Found and leaving to your site maybe they’ll found a Page Not Found to find something that they’re looking for or something else that interest them and it will keep that user from leaving your website.
It allows you to do a couple of other cool things in the configurations so go ahead and take a look at that, go ahead and open up the configuration again and you can have it so it jumps directly to the search result when there’s only one result so that’s kind of a neat little feature and you can read through this and it will use a couple of other or allow you to use a couple of other modules like the Search By Page Module or the Google CSE … CSE Search Modules, you can also do a search with a custom path if you have a view that would … if you have a path parameter you can use the results and push it right into a view, you can use a 301 or redirect it instead of a 302, if it’s a very large site you can disable the auto search and just have it populate the text field with the text so they can go ahead and hit the search button but it does actually perform this search and you can also disable the error message.
So let’s go ahead and save this and give it a try. There’s also a whole bunch of more advance options, it’s pretty self-explanatory on what it does, you can change the page title, add a page text and just change a whole bunch of settings for how the module reacts when you’re actually doing a search.
So let’s go ahead and do this again; as you can see it says please try a search, that’s the text, I got to change the page title, let’s go ahead and try where I will only get one result. You can see it’s redirected from test/article/2 to this actual test article page so it changed the URL and it does redirect to this article page because there was only one result in the listing, if I wouldn’t change it to just to test article again I get both results, I had the two and notice there’s only one result there.
So in this case 301 redirect me directly to the article. So as you can see it’s a really simple module, it can be useful especially if you have a lot of content on your site and you have links that maybe have become broken for whatever reason or you have someone linking to your site and a link that doesn’t or no longer work or maybe it never work.
So go ahead and give it a try, see what you think and let me know if you have any other modules or module development, theme development ideas for future Daily Dose of Drupal videos. Thanks again for watching.