0

May this be the stupidest question ever, sorry if so, but I cannot figure it out:

I have in my HTTPS page:

<a href="../../../folder/index.php?openMenu=SEARCH">Advanced searh</a>

And this would work but the link points to a HTTP page (not S).

So when I click on the Advanced search link, I go to the right place but for the https that should be http and therefore I get a page not found.

Is there anything PHP/javascript/jquery I can do to avoid this?

Thanks a lot

Miguel Mas
  • 547
  • 2
  • 6
  • 23

1 Answers1

1

This can't be achieved without using absolute URL. https://stackoverflow.com/a/6654427/1856120

Take a look at phpUri:

phpUri::parse("http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]")->join('../../relative-path') // HTTP link;

phpUri::parse("https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]")->join('../../relative-path') // HTTPS link;

https://github.com/monkeysuffrage/phpuri

Or using this: https://stackoverflow.com/a/4444490/1856120

Community
  • 1
  • 1
František Maša
  • 354
  • 1
  • 10