If you want to get the current URL of the page in Magento, there are a lot of solutions. I have given below the easiest and tested method here