Search redirects, introduced in Better Search Pro 4.4.0, send visitors straight to a specific post, page or URL when they search for a matching keyword — before the search results page loads. Redirected searches are still recorded in your search statistics.
Enabling search redirects
- Go to Better Search → Settings in the WordPress admin.
- Open the Features tab and turn on Search redirects.
- Save your changes. The Redirects tab will appear.
- Open the Redirects tab and add your rules.
Adding a redirect rule
Click Add redirect and fill in these fields:
- Keywords — comma-separated list of search terms that trigger this redirect (e.g.
support, help, contact us). With the Wildcard match type,*stands for any characters. - Send visitors to this post or page — enter the ID of the post or page. The post must be published and not password protected. Leave this blank to use a URL instead.
- Or send them to this URL — a full address such as
https://example.com/help/, or a path on this site such as/contact/. Only used when the post or page field is blank. - Match type — Exact match matches the whole search phrase. Wildcard (
*)* matches the whole search phrase with `` standing for any characters. Contains** matches when the keyword appears anywhere in the phrase. - Redirect type — 302 (Temporary) or 301 (Permanent). Use 302 unless you are certain the rule is permanent — browsers cache 301 redirects aggressively.
- Enabled — uncheck to switch a rule off without deleting it.
You can add as many rules as you need. Rules are checked in order, with exact matches always taking priority over wildcard matches, and wildcard matches over “contains” matches. Matching ignores case, leading/trailing spaces, and repeated spaces.
How matching works
When a visitor performs a search, Better Search Pro checks every redirect rule before the search runs. Matching respects these behaviors:
- Exact rules first: all exact-match rules are tried first, then wildcard rules, then “contains” rules, regardless of list order.
- First match wins: when multiple rules could match, the first one in the list takes effect. Reorder rules so more specific matches are higher up.
- Case and whitespace: matching is case-insensitive and collapses repeated spaces. Leading and trailing spaces are ignored.
- Search statistics: even when redirected, the original search query is recorded so your search statistics and “Did you mean” suggestions stay accurate.
Wildcard matching
Added in Better Search Pro 4.5.0, the *Wildcard (`)** match type lets a single keyword cover a range of search phrases. The*` character stands for any characters, including none.
Wildcard keywords are anchored, so the pattern has to cover the whole search phrase:
| Keyword | Matches | Does not match |
|---|---|---|
help* | help, help me, helpdesk | please help me |
*help* | help, please help me, self-help guide | — |
*guide | buying guide, style guide | guide to WordPress |
* | every search | — |
- A keyword with no
*behaves exactly like an exact match. - A bare
*is a catch-all. Because wildcard rules are checked before “contains” rules, a catch-all rule stops any “contains” rule further down the list from ever running. - Characters that have a special meaning in patterns elsewhere — such as
.,(or+— are treated literally, so a keyword likef(x)*matches the text you typed.
Bypassing redirects for testing
Append ?bsearch_no_redirect=1 to any search URL to see the results page instead of following the redirect. This only works for administrators.
Developer hooks
bsearch_before_search_redirectOpens in a new window — fires before a search query is redirected. Receives the destination URL, matched rule array, and search query.bsearch_search_redirectsOpens in a new window — filters the array of redirect rules before matching.bsearch_is_redirectable_searchOpens in a new window — filters whether the current request may be redirected by search rules. Returnfalseto skip redirection for the current request.bsearch_allow_offsite_redirectOpens in a new window — filters whether a redirect may send visitors off-site. Defaulttrue. Returnfalseto restrict redirects to the current site only.
