Joy
(@joyously)
That would work if the URL contained search, like http://www.abc.com/search/hello
But it’s not a good idea to let your users dictate your URLs like your example. The example would clash with any existing Pages that you have.
Thread Starter
ct1601
(@ct1601)
Can you please give me an introduction on how to set this up?
Much thanks for your reply
Add a rewrite rule that matches the “search” URL element and passes the subsequent element as the value to the “s” query var.
https://developer.wordpress.org/reference/functions/add_rewrite_rule/
For example, if the request were example.info/search/foo/, the rewritten URL would then be example.info/index.php?s=foo You also need your search form to make such a request. A form could make the rewritten URL request (s=foo) on its own, but if you want a /search/foo/ sort of request, it’ll take some JavaScript to construct the URL and submit it instead of allowing the form default to work.