1

I have been using the following to discover the full url, but it does not detect the subdomain I am calling from.

$current_url = "http://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]."";
echo $current_url;EXIT;

Any advice?

2 Answers 2

1

$_SERVER['HTTP_HOST'] should include the subdomain. Can you link us to an example page?

Sign up to request clarification or add additional context in comments.

Comments

1

Tested and works fine for me. Used this code:

<?
$current_url = "http://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]."";
echo $current_url;EXIT;
?>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.