I need to get the current url, like https://www.mypage.com/subfolder/iamhere.html
I know that I can get the templatePath using getCurrentTemplatePath(), but I need the url and I don't know how to do that.
I searched in google and stackoverflow, but I always ended up either with non cfml code or the templatePath.
The sample URL you give is an HTML page. For that, you'd need Javascript. Something like:
var addr = window.location.href;
For ColdFusion, be sure you're using code on an actual CFML page. For instance: https://www.mypage.com/subfolder/iamhere.cfm
If this is the case, like others have said, you should use the CGI scope. As an example:
<cfset addr = (cgi.SERVER_PORT IS 443?'https':'http') & "://" & cgi.HTTP_HOST & cgi.HTTP_URL>