Fix Double Encoded %20 in Drupal Apache Solr Search

This is difficult to troubleshoot because there are a variety of patches aimed at fixing this issue depending on the version of PHP your server is running. This relates to version 7.x-1.x

For my main server I required this patch
diff --git a/ b/
index f4c8ac4..f61e8ad 100644
--- a/
+++ b/
@@ -99,8 +99,8 @@ function apachesolr_search_custom_page_search_form_submit(&$form, &$form_state)
// Also encode slashes so we don't get akward situations when obtaining the
// search key. We can't use drupal_encode_path because for "aestetic" reasons
// they don't encode slashes...
- $redirect_value = rawurlencode($form_state['values']['keys']);
+ $redirect_value = trim(str_replace("/","%2f",$form_state['values']['keys']));
if (strlen($form_state['values']['keys'])) {
$redirect .= '/' . $redirect_value;

You can also check out

Here is the thread on Drupal's website: