changing static link to relative link

I have self hosted my wordpress today, but I realised it is still having static link of my local installation, since now I am opening using my IP (as i haven’t done DDNS yet) i want that link should change to IP followed by ret of the URL instead of static local url.

Any help would be greatly appreciated.

2

Answers


  1. prosti
    0 Votes

    I guess you need to simple set your web server IP in wp-config.php like this:

    define('RELOCATE',true);
    define('WP_HOME','https://11.22.33.44');
    define('WP_SITEURL','https://11.22.33.44');
    

    And try if you don’t have the web server problem.

    curl -I https://11.22.33.44
    

    and if you access the

    curl -I http://11.22.33.44
    

    is it forwarding properly…

    Important! Leaving the RELOCATE constant in your wp-config.php file is insecure, as it allows an attacker to change your site URL to anything they want in some configurations. Always remove the RELOCATE line from wp-config.php after you’re done.

    Resouce https://codex.wordpress.org/Changing_The_Site_URL

  2. Naresh Kumar.P
    0 Votes

    I am happy that i would suggest you with some strategies so that you may find which one is useful and make use of it as per the scenarios that you are pertaining to it.

    Solution One:

    Bit Easier with the help of the plugin in WordPress.

    Plugin Name: Relative URL

    Plugin URL: https://wordpress.org/plugins/relative-url/

    Description: Relative URL applies wp_make_link_relative function to links to convert them to relative URLs.

    Solution Two:

    How to Make Internal Links Relative in WordPress

    Reference: I have found out a very easy and worth example so that you can follow it up and you can make the static links to relative on the fly.

    https://www.webhostinghero.com/how-to-make-all-internal-links-relative-in-wordpress/

    Solution Three:

    An another Stack Overflow Answer that is found very useful when using relative URL is as follows:

    Question: Relative URLs in WordPress

    Solution: http://stackoverflow.com/questions/17187437/relative-urls-in-wordpress

    Solution Four:

    Another Informative posts that i have found to be is the below link and it is very much superb in order to make the relative URLS.

    Reference: http://www.deluxeblogtips.com/2012/06/relative-urls.html

    Hope so any of the methods will be useful and you may crack the hindrance that you have using these four methods on the fly.

    Happy Coding 🙂

Please signup or login to answer this question.

Signup for an account and start participating in our site today!




Social Signup

You can also login with your Facebook, Twitter or Linkedin account

Log in with Facebook