Question #622   Submitted by Answiki on 10/05/2021 at 10:20:39 AM UTC

In PHP, how to get the full current URL with parameters?

Answer   Submitted by Answiki on 10/05/2021 at 10:44:07 AM UTC

In PHP, to get the full URL of the current page with parameters, the best option is to concatenate the following variables :

// Get the full URL with protocole and parameters
// As an example: https://www.example.com/page.html?param1=abc&param2=123
$url = ( ($_SERVER['HTTPS'] ?? 'off' === 'on') ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];

10 events in history
Question by Answiki 11/06/2021 at 10:51:58 AM
How to get the full current URL with parameters in PHP?
Answer by Answiki on 10/05/2021 at 10:44:07 AM

In PHP, to get the full URL of the current page with parameters, the best option is to concatenate the following variables :

// Get the full URL with protocole and parameters
// As an example: https://www.example.com/page.html?param1=abc&param2=123
$url = ( ($_SERVER['HTTPS'] ?? 'off' === 'on') ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];

Answer by Imabot on 10/05/2021 at 10:29:13 AM

In PHP, to get the full URL of the current page with parameters, the best option is to concatenate the following variables :

// Get the full URL with protocole and parameters
// As an example: https://www.example.com/page.html?param1=abc¶m2=123
$url = ( ($_SERVER['HTTPS'] ?? 'off' === 'on') ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];

Question by Answiki 10/05/2021 at 10:20:57 AM
In PHP, how to get the full current URL with all $_GET parameters?
Question by Answiki 10/05/2021 at 10:20:49 AM
In PHP, how to get the full current URL with all parameters?
Question by Answiki 10/05/2021 at 10:20:39 AM
In PHP, how to get the full current URL with parameters?
Question by Answiki 10/05/2021 at 10:20:28 AM
In PHP, how to get the full URL of the current page with parameters?
Answer by Answiki on 10/05/2021 at 10:20:20 AM

In PHP, to get the full URL of the current page with parameters, the best option is to concatenate

// Get the full URL with protocole and parameters
// As an example: https://www.example.com/page.html?param1=abc¶m2=123
$url = ( ($_SERVER['HTTPS'] ?? 'off' === 'on') ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];

Answer by Answiki on 10/05/2021 at 10:20:13 AM

In PHP, to get the full URL of the current page with parameters, the best option is to concatenate


// Get the full URL with protocole and parameters
// As an example: https://www.example.com/page.html?param1=abc¶m2=123
$url = ( ($_SERVER['HTTPS'] ?? 'off' === 'on') ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];

Answer by Answiki on 10/04/2021 at 08:19:33 PM

To get the full URL with parameters in PHP, the best option is to concatenate


// Get the full URL with protocole and parameters
$url = ( ($_SERVER['HTTPS'] ?? 'off' === 'on') ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];

# ID Query URL Count
0 6817 quel son les meilleurs site d'annonce allemend 2022 https://en.ans.wiki/622/in-php-how-to-get-the-full-current-url-with-parameters 1
1 5959 Annonce en allemage https://en.ans.wiki/622/in-php-how-to-get-the-full-current-url-with-parameters 1

Icons proudly provided by Friconix.