Will the ConvertToInternal() method also return UnifiedFiles? If it's a page internalObject can be casted to a PageReference.
if (Global.UrlRewriteProvider.ConvertToInternal(new EPiServer.UrlBuilder(url), out internalObject))
UnifiedFile file = internalObject as UnifiedFile;
if (file != null)
Or should I go with the HostingEnvironment.VirtualPathProvider.GetFile()?
Just go with HostingEnvironment.VirtualPathProvider.GetFile, the ConvertToInternal only cares about mapping external paths to internal paths - I don't think you can get an UnifiedFile from there.
Why is the out parameter of type object, if it only returns page references? Would have been nice with some xml-comments on methods like these.
You could argue that it is too abstract but that it is how the URL rewriters are designed. The method will convert whatever you send in and return an hint (the out value) to what internal representation it used, in most cases it is a PageReference but nothing says it must be depending on the provider.
Is the result cached after the ConvertToInternal() is called?
Yes, 10 seconds by default