• Resolved friedribs

    (@friedribs)


    Hi, i’m using abt-relative-urls v0.3.2, and I had to switch the code:

    $this->absolute_prefix = home_url();

    back to

    $this->absolute_prefix = 'http' . (isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] == "on" ? 's' : '') . '://' . $_SERVER['HTTP_HOST'];

    because my wordpress install is in a folder on my server, not directly in the root, so my home url is something like this:
    https://www.whatever.com/wordpress

    So it doesn’t change the urls to go from the the real server root. (It chops off the “/wordpress” part of the url.)

    Other than that, I really like the plugin! thanks!
    Bill.

    https://www.ads-software.com/extend/plugins/abt-relative-urls/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author zaus

    (@zaus)

    Glad you like it! Regarding your fix, were you seeing your content links turning into “/my-relative-link” instead of what you wanted as “/wordpress/my-relative-link”?

    If so, I would think an admin setting to adjust this behavior would be useful, but not sure when I’ll be able to apply it.

    I’d never tried using this feature in a subdirectory, so this unfortunately didn’t occur to me, but thanks for pointing it out.

    Thread Starter friedribs

    (@friedribs)

    Exactly my problem. I’ve modified your code to this which solves the problem for me:

    preg_match('#.*?://.*?(?:(?=/)|.$)#', home_url(), $matches);
    $this->absolute_prefix = $matches[0];

    You can play with the above regex here to prove that it works:
    Test RegEx

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: ABT Relative Urls] Problem with using home_url() to get root’ is closed to new replies.