• Resolved datacompboy

    (@datacompboy)


    I have site accessed via several hosts, like
    http://ru.site/
    http://en.site/
    etc, and want to have wordpress works fine on that setup, but it require full path for site_url.

    so, i have made micro patch to
    wp-includes/canonical.php

    in function redirect_canonical(…)
    in bottom, changed from

    if ( array($original['host'], $original['port'], $original['path'], $original['query']) !== array($redirect['host'], $redirect['port'], $redirect['path'], $redirect['query']) ) {
            $redirect_url = $redirect['scheme'] . '://' . $redirect['host'];
            if ( isset($redirect['port']) )
                $redirect_url .= ':' . $redirect['port'];
            $redirect_url .= $redirect['path'];
            if ( $redirect['query'] )
                $redirect_url .= '?' . $redirect['query'];
        }

    to

    if ( $redirect['host'] && array($original['host'], $original['port'], $original['path'], $original['query']) !== array($redirect['host'], $redirect['port'], $redirect['path'], $redirect['query']) ) {
            if ($redirect['host']) {
              $redirect_url = $redirect['scheme'] . '://' . $redirect['host'];
              if ( isset($redirect['port']) )
                  $redirect_url .= ':' . $redirect['port'];
            } else {
              $redirect_url = "";
            }
            $redirect_url .= $redirect['path'];
            if ( $redirect['query'] )
                $redirect_url .= '?' . $redirect['query'];
        }

    and now can setup siteurl as /wp
    and it works fine —
    http://ru.site/wp/
    http://en.site/wp/
    shows same site without redirects, and in wp-config i can change language based on $_SERVER[‘HTTP_HOST’]

    🙂

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Blog relative paths’ is closed to new replies.