Wednesday, 14 May 2014

How you will get the url of page in php


If you print  $_SERVER['HTTP_HOST'] you wll get the host address, suppose www.websnit.com

And if you print $_SERVER['REQUEST_URI'] you will get the last part of domain name.


I have used it in WordPress site to track the home page.

full address is :
"http://".$_SERVER['HTTP_HOST']. $_SERVER['REQUEST_URI'];





No comments:

Post a Comment