In my community site, I wanna get current site url in my apex class. I want to get the whole url, not just the domain part Instead of https://abc.site.com/ I want the whole https://abc.site.com/page?key1=xxx&key2=xxx All I can find is the way to get domain part, don't know how to do this. Any help will be appreciated!!!

1 Answer 1


From the question, it seems like you want to get the complete URL(+Query Parameter) and do some processing in Apex.

You can not get the query parameters directly in apex as apex does not have any context.

Assuming you are calling Apex method from VF page or Lightning component from inside community, you can get the complete URL in JS using window.location.href and then pass it to apex

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .