Nick Hebb Nick Hebb - 1 year ago 50
PHP Question

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

I moved a WordPress installation to a new folder on a Windows/IIS server. I'm setting up 301 redirects in PHP, but it doesn't seem to be working. My post URLs have the following format:


I can't figure out how to grab the
part of the URL.

- which everyone seems to recommend - is returning an empty string.
is just returning
. Why is this, and how can I fix it?

Answer Source

Maybe, because you are under IIS,


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

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