Might be better to split the path on '/' and take the first bit.