Skip to main contentSkip to footer

Redirects

Send visitors to the right destination for a search

Relevanssi Premium can send a visitor directly to a chosen URL when their search matches a saved rule. Use this for searches with a clear destination, such as “jobs” for a careers page or “hours” for opening hours. The visitor reaches the destination instead of seeing the search results page. On this user manual site we use jobs as our search term to demonstrate how it works.

Configure a redirect

  1. Open Relevanssi > Settings > Searching, then scroll to the Redirects section. Its configuration panel is labelled Redirect Rules.
  2. In an empty rule row, enter jobs under Query String keyword. This is the search text that should trigger the redirect.
  3. Enter /careers/ under Target Redirect URL, replacing it with the path to your actual careers page. For another website, use a complete HTTP or HTTPS URL.
  4. Leave Partial match switched off if the rule should match only the complete query jobs. Switch it on if the keyword should also match inside a longer query.
  5. Save the options, then search for jobs through your site’s frontend form. Confirm that the destination page opens instead of the results page.

Use Add New Redirect Rule below the list when you need another rule row. Fill in its keyword, matching preference, and destination, then save the options. Text such as e.g., help or /support/ shown in an empty field is a placeholder, not a saved rule.

Relative destinations are resolved against WordPress’s site URL. If WordPress is installed in a subdirectory, check the resulting destination carefully. Invalid destinations can be discarded when the options are saved; reopen the tab to confirm that the rule was retained.

You can edit existing rules directly in their rows. To discard a rule when saving, clear its keyword or destination: a row needs both values to be retained. Updating redirect rules does not require rebuilding the search index.

Exact and partial matches

With Partial match disabled, a rule for jobs matches the complete query jobs, including a case variation such as JOBS. It does not match jobs available. A keyword can also be a multiword query such as opening hours.

With Partial match enabled, the saved text can appear anywhere in the search query, including inside another word. A partial rule for jobs therefore also matches jobs available and myjobsboard. Use a sufficiently specific keyword to avoid sending unrelated searches to the same page.

These are text matches, not regular expressions or search wildcard patterns. If more than one rule matches, the first matching rule in the saved list wins. A broad partial rule can therefore take precedence over a more specific rule below it. Avoid duplicate keywords and overlapping rules unless that behaviour is intentional.

Redirect searches without results or terms

The Redirects section includes two separate optional destinations:

  • Redirect empty searches: sends a search with zero results to the specified URL. Here, “empty” means no matching results, even when the visitor entered a search term.
  • Redirect searches without terms: sends a search request with no search text to the specified URL.

Leave a destination blank if you want to keep the normal behaviour. Keyword rules are checked first. If no keyword rule matched, a search without terms uses its dedicated destination before the zero-results destination is considered.

The no-terms setting applies when WordPress receives a search request. If your form prevents empty submissions or sends them to the homepage instead, test and adjust the form’s behaviour separately.

Optional: add several rules at once

For a longer list of rules, you can use Bulk Add via CSV instead of entering each rule separately. Expand the panel and paste rules into CSV Redirect Data. Despite the CSV label, the parser uses semicolons. Enter one rule per line, in this order: query, destination URL, and partial matching flag.

jobs;/careers/;0
hours;/opening-hours/;1
address;/contact/;0

The third value 1 enables partial matching; 0, or omitting the third value, leaves it disabled. Leading and trailing spaces around these values are removed. Use plain values without a header row or quoted CSV fields, and do not put a semicolon inside a value.

Save the options to add the rows. This adds rules alongside the rows already in the form; it is not an import that replaces the existing list. Repeating the same bulk input can create duplicate rules, so check the saved list before importing it again.

Test and monitor the rules

The Hits column counts how often each keyword rule has matched. It is a redirect-use counter, not the number of search results. The redirect normally uses HTTP status 302; it is not a permanent URL replacement.

Test the exact query, a case variation, a longer query, and a word containing the keyword. Check overlapping rules and both fallback destinations. Confirm the destination as a logged-out visitor and make sure it does not send the visitor back into a redirect loop.

Redirects run during the frontend request before WordPress renders the page. They are not a replacement for a custom Ajax response: a live-search dropdown or another plugin’s custom endpoint may need its own integration. Test the actual search form rather than assuming all search interfaces will navigate in the same way.

For an advanced alternative based on taxonomy terms, see Automatic redirects for taxonomy term archives.