How to Get the Current Page'S Full Url on a Windows/Iis Server

How can I get the current page's full URL on a Windows/IIS server?

Maybe, because you are under IIS,

$_SERVER['PATH_INFO']

is what you want, based on the URLs you used to explain.

For Apache, you'd use $_SERVER['REQUEST_URI'].

How to reliably get the current URL in PHP?

Use $_SERVER['REQUEST_URI']. This should give you the URL that the visitor is using.

how to get the url of the current page using php


<?php
$url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
echo $url;
?>

IIS keep some urls when changing domain

I think what you're looking for is the URL_REWRITE Extension.

You can download it here: https://www.iis.net/downloads/microsoft/url-rewrite

Then apply the rewrite rules at the server level not the application level. This will allow you to easily control the the flow of any your old URLs to your new location.

Depending on how many you have theirs a few different ways you can do it with URL_Rewrite.

To get you started here's a bunch of tutorials on how to use it: https://www.iis.net/learn/extensions/url-rewrite-module

After you play with it and if have any specific questions, just ask on stackoverflow and tag the question with URL-REWRITE-MODULE



Related Topics



Leave a reply



Submit