Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author intuitart

    (@intuitart)

    Are you trying to display a different url than what was saved? You can do that.

    Or are you wanting it to go through the database and remove absolute urls? The absolute part of a url is removed when it is saved, and at this time there is no batch process to do that retroactively. You would have to edit and re-save a post to remove urls.

    Thread Starter amihaita

    (@amihaita)

    I am trying to transform all my absolute URL’s in relative URL’s, because now I’m testing a site and several people should see it, some from inside the network and others from outside and displaying images is a total mess. I thought to a VPN for those that are outside, but it is too complicate for them to use it.
    So the single acceptable solution for me is transform all the absolute paths to relative. Just some of the paths I didn’t find where are saved, so I thought that with your module could solve the problem.

    Plugin Author intuitart

    (@intuitart)

    To accomplish this you have two things to deal with.

    First, I assume those accessing the site from outside have a different URL than the ones accessing the site from inside. You can deal with this by adding two lines to wp-config.php. This tells WP, and this plugin, to use the URL accessing the site as the site and wordpress URLs.

    define( 'WP_SITEURL', $_SERVER['REQUEST_SCHEME'] . '://'. $_SERVER['HTTP_HOST'] );
    define( 'WP_HOME', $_SERVER['REQUEST_SCHEME'] . '://'. $_SERVER['HTTP_HOST'] );

    Second, you want existing posts to have relative URLs so they display properly both inside and outside the organization. There are a couple of ways of handling this. If there are only a few posts at the moment, just enable this plugin, edit and re-save each post. This will convert the URLs to relative. The second option is to use the related_sites filter in functions.php so that the plugin treats specific URLs as though they are relative.

    add_filter( 'of_absolute_relative_urls_related_sites',
        function( $related_sites ) {
            $related_sites[] = "http://originalsite.org";
            return $related_sites;
        }
    );

    Replace originalsite.org with your own domain.

    Hope this helps,

    Andrew P.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Useless’ is closed to new replies.