url_strip_port
urlRemoves the port from a URL
Syntax
url_strip_port(url) Parameters
url (string) The URL string to modify
Returns
string The URL without the port number
Examples
Input:
url_strip_port("https://example.com:8080") Output:
"https://example.com" Input:
url_strip_port("https://example.com:8080/path?query=value") Output:
"https://example.com/path?query=value" The url_strip_port() function removes the port number from a URL, including the β:β separator, regardless of whether itβs a default or custom port.
Usage
Use url_strip_port() when you need to normalize URLs by removing all port specifications, such as creating canonical URLs or simplifying URL comparison across different port configurations.