Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

$_SERVER["SCRIPT_URI"] not working? alternative?

Tags:

php

This is odd, but for some reason the $_SERVER["SCRIPT_URI"] will not return the domain name when I am in child/sub-pages but will only work on the main page. Not sure if its due to the script (WordPress) or host, but please can you suggest any reliable solution to retrieve the domain name with PHP?

like image 870
Ahmad Fouad Avatar asked Apr 04 '09 21:04

Ahmad Fouad


Video Answer


1 Answers

If you need domain name, use:

$_SERVER['HTTP_HOST']
like image 98
vartec Avatar answered Oct 06 '22 20:10

vartec