$current_url = $_SERVER['REQUEST_URI']; echo "Current URL: " . $current_url;
$url = 'https://www.example.com/products?id=123'; $url_parts = parse_url($url); echo "Domain: " . $url_parts['host'] . "
"; echo "Path: " . $url_parts['path'] . "
"; echo "Query String: " . $url_parts['query'];
function create_slug($title) { $slug = strtolower(trim(preg_replace('/[^A-Za-z0-9-]+/', '-', $title))); return $slug; } $title = "7 Tips for Creating Effective SEO Strategies"; $slug = create_slug($title); echo "SEO-friendly URL: " . $slug; // Output: "7-tips-for-creating-effective-seo-strategies"Package Library: None Overall, PHP provides a wide range of functions and packages to make website development easy and efficient. By using PHP page URLs, you can retrieve, parse, and generate SEO-friendly URLs for your website.