Online Forum To Support Coders With Technical Assistance - Read Write Execute

Get current full url in php

Ankit Agrawal
Ankit Agrawal
Published on October 24, 2017 · 1 min read

$currentPage =  'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; 
 
If you want to check that ssl is enable or not then use below code
 
$currentPage =  (isset($_SERVER['HTTPS']) ? "https" : "http") . "://". $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];

Was this article helpful?
Ankit Agrawal

Ankit Agrawal

Author & Senior Engineer at CodeExecute

Writing practical engineering guides, debugging real-world bottlenecks, and creating free tools for developer productivity.

← Previous Article Clear chache in smarty Next Article → Display hidden files in cpanel