• robwhitaker1

    (@robwhitaker1)


    Hi All,

    Im new to this forum and I could really use some expert advice.

    I have posted this on another forum with no joy, and had my hosting provider on the phone for half an hour before eventually giving up (local installs not really covered under web support!), I really cant get my head around it.

    Im using WordPress, Im new to web dev, and last year learned how to install a local version of the site for testing purposes which I have done around ten times with no problems.

    However, the most recent time I have tried this, when I type ‘localhost/mytestsite’ it redirects me to ‘www.mylivesite.com/mytestsite’ and obviously get a 404.

    Every other old local site I have is working fine i.e. ‘localhost’ is not being replaced with ‘www.livesite.com’ in the URL. I have even removed the .htaccess and obviously triple checked that the options in the DB are correct, as well as the credentials in the wp-config, and added:

    define(‘WP_HOME’,’http://localhost/mytestsite’);
    define(‘WP_SITEURL’,’http://localhost/mytestsite’);

    However, when I type in 127.0.0.1 in my address bar it DOES send me to http://www.mylivesite.com, despite the old local installs working fine?!

    Can anybody help me figure out what is causing the localhost to do this? I am at a loss.

    Im using MAMP, let me know if any more info can help.

    Thanks in advance for anybody that can help

    All the best

    Rob

Viewing 3 replies - 1 through 3 (of 3 total)
  • cthomasfr

    (@cthomasfr)

    This seems to be the good way to do the URL change

    Add these 2 following lines to wp-config.php is one solution.
    define(‘WP_HOME’,’http://localhost/mytestsite’);
    define(‘WP_SITEURL’,’http://localhost/mytestsite’);

    There are others solutions to change URL, maybe you can try
    https://codex.wordpress.org/Changing_The_Site_URL

    But maybe you can try first to clear your cache and cookie from your browser.

    Thread Starter robwhitaker1

    (@robwhitaker1)

    Hi Thomas, thanks for the reply.

    As above, I can confirm I have already added these two lines to the wp-config and changed the entries in the database.

    Any other suggestions? Never had this problem before!

    Thanks!

    Thread Starter robwhitaker1

    (@robwhitaker1)

    Just to update on how I fixed this-

    I don’t know by what magic… but by renaming my root folder & creating a fresh one, copying my website files into there, and clearing my cache, my test site now works fine with no redirection to the live URL?!

    I’d be very interested to know if anybody had any ideas as to what the problem was based on this anyway.

    Happy Days

    Rob

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘'localhost'being replaced with 'www.livesite.com' in URL of ONE of my local&#039’ is closed to new replies.