[OJS] Request url without context_id

Dear all,

our journal is one of multiple journals in the OJS installation of our library. The journal has it’s own domain: https://meta-journal.net. To have nice urls like https://meta-journal.net/issue/current we have rewrite rules of apache in place.
For the plugin I’m developing I need the URL of the page requested. The PKPRequest provides the getCompleteUrl and getRequestUrl methods. The problem for me right now is that both methods return the URL with the context_id included.
So instead of: Archiv | Middle East - Topics & Arguments
I get: Archiv | Middle East - Topics & Arguments

Is there a possibility to get the initial (not rewritten) url that I’m missing?

Best,
Markus

Hi @MarHerUMR,

How are you using the generated URL? Can you use the Request::url function?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

thanks, this is exactly what I wanted (and didn’t see). Both, the Request.inc.php and the PKPRequest.inc.php state the method as deprecated. Do you know what method to use instead??

The url will be inserted as a <meta> tag.

Best,
Markus

Oh, after having a closer look it actually doesn’t do it all the way. Using it for Archiv | Middle East - Topics & Arguments works fine. But using it for Bd. 3 (2014): Cultural Heritage | Middle East - Topics & Arguments leaves me with https://meta-journal.net/issue/view/.

Hi @MarHerUMR,

I suppose you could pick something directly out of the $_SERVER array – but if you’re dogmatically dumping user-supplied content into your meta fields, watch out for potential abuses.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

because of the potential abuse of the input I decided to go with the Request::url method (and actually using it the right way). It would be great when there’s are equivalent when the url method will be removed.

Best,
Markus