Added ltrim to $url var to prevent double slashes on flush