diff --git a/mongoose.c b/mongoose.c
index 270ef1f5e16c28f3c3cebcca4cd0c60efab7214f..c8fa690f25092905aff77612d1f9073627cc241a 100644
--- a/mongoose.c
+++ b/mongoose.c
@@ -2233,6 +2233,7 @@ static int convert_uri_to_file_name(struct connection *conn, char *buf,
 
   // Handle URL rewrites
   mg_snprintf(buf, buf_len, "%.*s%s", root_len, root, uri);
+  rewrites = conn->server->config_options[URL_REWRITES];  // Re-initialize!
   while ((rewrites = next_option(rewrites, &a, &b)) != NULL) {
     if ((match_len = match_prefix(a.ptr, a.len, uri)) > 0) {
       mg_snprintf(buf, buf_len, "%.*s%s", (int) b.len, b.ptr, uri + match_len);