diff --git a/mongoose.c b/mongoose.c
index 6de5190a65095e90ca2b8b5753672973938e0df1..a87b99cb0eec5efe78736d00020be0d822a7d54c 100644
--- a/mongoose.c
+++ b/mongoose.c
@@ -2216,7 +2216,7 @@ static int convert_uri_to_file_name(struct connection *conn, char *buf,
   // Perform virtual hosting rewrites
   if (rewrites != NULL && domain != NULL) {
     const char *colon = strchr(domain, ':');
-    int domain_len = colon == NULL ? strlen(domain) : (int) (colon - domain);
+    int domain_len = colon == NULL ? (int) strlen(domain) : colon - domain;
 
     while ((rewrites = next_option(rewrites, &a, &b)) != NULL) {
       if (a.len > 1 && a.ptr[0] == '@' && a.len == domain_len + 1 &&