{"id":4561052,"date":"2014-01-30T22:28:35","date_gmt":"2014-01-30T22:28:35","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/issue-with-search-url-rewrite\/"},"modified":"2016-08-21T15:20:08","modified_gmt":"2016-08-21T15:20:08","slug":"issue-with-search-url-rewrite","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/issue-with-search-url-rewrite\/","title":{"rendered":"Issue with search URL rewrite"},"content":{"rendered":"<p>Hi, <\/p>\n<p>I do rewrite my search URL like so<\/p>\n<pre><code>if ( is_search() &amp;&amp; !empty($_GET[&#039;s&#039;])) {\n      wp_redirect(home_url(&quot;\/find\/&quot;) . urlencode(get_query_var(&#039;s&#039;)));\n      exit();\n    }<\/code><\/pre>\n<p>and I just figured that the WP SEARCH is not working anymore. It brings up the next best available page or post ULR or the 404 page. Honestly I am not sure if polylang is causing the trouble, so this is just me asking if it could be since it is the one plugin that touches URLs.<\/p>\n<p>Oh and when I remove the URL rewriting the search works fine again.<\/p>\n<p>I run many more website with my exact same theme but no polylang plugin and there the search works perfectly fine.<\/p>\n<p>Anybody an idea or even a fix?<\/p>\n<p>Thanks a lot for your support.<br \/>\nCheers, Alex<\/p>\n<p>PS<br \/>\n&#8211; when I &#8216;deactivate&#8217; all plugins the search is still broken with the rewrite and works without the rewrite.<br \/>\n&#8211; also copied the rewrite code and the search.php template code from a site where it works fine to see if my code causes the trouble but the search was still broken<\/p>\n<p>https:\/\/wordpress.org\/plugins\/polylang\/<\/p>\n","protected":false},"template":"","class_list":["post-4561052","topic","type-topic","status-closed","hentry","topic-tag-url"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/4561052","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/4561052\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=4561052"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}