Keyword replacements on Not Found Page


(gja) #1

Hi,

I’m attempting to find a keyword replacement to give me the url that generated the 404.
Or alternatively the url of the link that is broken.

We have a global 404 page that is linked into many sites so we need the full url of the broken link, not just the last part.

I’ve tried

  • %globals_server_request_uri% - but this only returns the last part, and not the protocol and server name ( e.g. http(s)://mysite.com)
  • %globals_asset_url% - gives me the url of the asset itself (which is not the destination of the broken link)
  • %frontend_asset_url% - seemed to be what I needed but doesn’t return a url when acting as a not found asset
  • %globals_server_request_url% - nothing

Any ideas?


(Lisa) #2

You could try: %globals_server_http_referer%


(gja) #3

We are already using %globals_server_http_referer% - that gives us the url of the page that contains the broken link, and not the actual broken link.

To explain more, I have a page http://mysite.com/home - on this page there is a link to http://yoursite.com/away.

The site asset for yoursite.com has a 404 page - asset name “404”

When I follow the link from mysite to yoursite I will be presented with the contents of the 404 page, on this page I want to include the urls http://mysite.com/home ( the referrer) and http://yoursite.com/away page that is being requested ( that doesn’t exist).


(Douglas (@finnatic at @waikato)) #4

I think we still have issues with referers - in particular we seem to have a repeat of the bug referred to in Global Keywords and Page Not Found assets which was fixed in 2014.


(Bart Banda) #5

Maybe try

%globals_server_https^eq:on:https:http%://%globals_server_http_host%%globals_server_request_uri%

or

%globals_site_url%%globals_server_request_uri%


(gja) #6

Hi,

%globals_server_https^eq:on:https:http%://%globals_server_http_host%%globals_server_request_uri% worked for me.

%globals_site_url%%globals_server_request_uri% - returned http even though the site is only available via https.
The site that this asset is in has both http and https enabled.

There seems to be a bit of an issue with keyword replacements not working correctly in the context of the 404 page.

As Douglas said the bug reported and fixed in 2014 seems to have returned.

%globals_server_http_referer% - works if the asset is specifically selected as the not found page.
but does not work when that asset is being returned via the setting in the Remap manager.


(Douglas (@finnatic at @waikato)) #7

Squizmap’d: https://squizmap.squiz.net/matrix/11336