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
$_SERVER[REQUEST_URI]
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:
$GLOBALS["HTTP_SERVER_VARS"]["REQUEST_URI"];
So I highly recommend that plugin developers use that reference instead.
Yes, I know they should be identical but apparently it’s an Apache + PHP bug.
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.
I had a similar problem. My php file inserted the $_SERVER['REQUEST_URI'] bit in a form sending stuff using the post method, and sent it as a hidden field to the logout script.
The logout script would get it and then re-direct to an index page using the header() function. However, this redirection only worked with Mac’s Safari for some weird reason. Anyway, the solution for me was to break out of PHP and use html’s tag. This way it all worked!. It’s strange how this works on some browsers and on others it doesn’t since it seems to be a server side issue not a client-side issue. Anyway, I’m happy I fixed it!
Hi,
Do you how to get this technique working on bbpress?
The problem is tracking conversions, as the “register” button is on every page, conversions cant be measured accurately if users register to the website, clicking on the button from a different page.
If I have domain/
And the register button is on the index domain/register.php
Measuring conversions that went from the index would go fine.
Suppose if a user is on page:
Domain/topic.php?id=694
I’d really love this to change into: domain/register.php?topic.php?id=694 (or something similar, but the entrance path should be also in the url)
Any ideas?
Thanks.