Possible Duplicate:
getting current URL
I wan't to use url (with any GET parameters, etc) in PHP code.
So when my website is on url: http:/sample.com/art/id/title I want to display this string in website.
There is also one thing... My code would be fired up on various servers with various url conventions.
Should account for just about any variations you might encounter (although mod_rewrite may screw it up in an un-correctable way, I'm not sure).
The following should give you both the domain and URL:
You have to have an .htaccess file, it's called URL re-write, an example .htaccess file:
This will send everything like art/id/title to your index.php page and will be usable using $_GET['query']. So in the index.php file, you can use the variable like so: