         NSLog("dispatching method: \(req.method)")
         NSLog("dispatching headers: \(req.headers)")
         
-        let filePath = path.URLByAppendingPathComponent(req.path).path!
+        var reqPath = req.path.stringByTrimmingCharactersInSet(NSCharacterSet(charactersInString: "/"))
+        if reqPath.rangeOfString("?") != nil {
+            reqPath = reqPath.componentsSeparatedByString("?")[0]
+        }
+        
+        let filePath = path.URLByAppendingPathComponent(reqPath).path!
         
         guard let body = NSData(contentsOfFile: filePath) else {
             NSLog("NOT FOUND: \(filePath)")

            }
        } catch {
            try HTTPResponse(
                request: req, statusCode: 500, statusReason: "Bad Request", headers: nil,
                body: [UInt8]("Invalid Range Header".utf8)).send()
            return
        }

        
        fd = sfd
        acceptClients()
        NSLog("Serving \(path) on \(port)")
    }
    
    func stop() {
