$_SERVER[‘REQUEST_URI’] doesn’t always work correctly! Here’s how to fix it.
Here’s something important for WP plugin developers that I have discovered on my server with wordpress and many plugins.
While PHP programmers have been taught to use
to fetch the current page URI, IT DOESN’T WORK CORRECTLY in all cases with wordpress’s rewrite functions.
I discovered this while working with the paged-comments plugin. It caused the template and other plugins to not see the proper URI and miss out on the extra stub in the URL.
After some studying of phpinfo results, I discovered that the proper, complete URI was shown in:
Yes, I know they should be identical but apparently it’s an Apache + PHP bug in some environments.
My server has apache 1.33 and php 4.2 so your milage may vary on the bug.
But since ALOT of people have that server combo, trust me, this prevents problems.