Hi, it seems the issue is related to the plugin. Caching can affect how server headers and HTTP requests are handled, potentially causing HTTP_REFERER to be inaccurate or unavailable. I suggest reaching out to their support team for help. https://wp-rocket.me/support/
@devinmaeztri Hi
Thanks. Are there any other options to retrieve the previous page URL?
Do you need the actual URL, or do you just want to have a “Back” link?
If you want the actual URL, the various PHP variables in $_SERVER are what you’ll have to work with. Alternatively you could always set a cookie with the current URL and read that in when the page loads before you update it to the current page URL.
If you just want a “Back” link, a JavaScript option is about the best way to do it.
<a href="javascript:history.back();">[Go Back]</a>