From 54355d8fb3bdb3cfa40167572da5d542c933c5a3 Mon Sep 17 00:00:00 2001
From: Pedro Nasser <pedronasser@gmail.com>
Date: Thu, 16 Jun 2016 10:03:31 -0300
Subject: [PATCH] replace strings.Split for SplitN

---
 caddyhttp/rewrite/to.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/caddyhttp/rewrite/to.go b/caddyhttp/rewrite/to.go
index 87c0b26b6..c49d4da11 100644
--- a/caddyhttp/rewrite/to.go
+++ b/caddyhttp/rewrite/to.go
@@ -21,7 +21,7 @@ func To(fs http.FileSystem, r *http.Request, to string, replacer httpserver.Repl
 	query := ""
 	for _, v := range tos {
 		t = replacer.Replace(v)
-		tparts := strings.Split(t, "?")
+		tparts := strings.SplitN(t, "?", 2)
 		t = path.Clean(tparts[0])
 
 		if len(tparts) > 1 {