Support » Localhost Installs » Set up test site, and wp-admin redirects to live site

  • I set up a local WP install on my Mac using MAMP to test an issue I’ve been having (see here for details on that issue if interested: My goal is to see if there are any problems with my WP database causing that issue (I have already done a fresh install of WP, disabled all plugins, etc.).

    Here’s the problem: After importing my database, I could no longer access my local site via http://localhost:8888 (whereas before, I could access the default “Just another wordpress site” and login at http://localhost:8888/wp-admin). Even when I changed the site address in the wp_options table (correctly, because I made note of it when I first installed WP locally), it could not find the local host. So, I did another backup of my live database, excluding the wp_options table, and imported it into my local database. I can access my local site, now with all the posts and pages from my live site, but with the default theme.

    HOWEVER, when I try to login using http://localhost:8888/wp-admin, it redirects to my live site’s login page. The wp_options table in the local database still says “http://localhost:8888” and I’m NOT redirected when I simply visit the local site. I searched my local database and cannot find anything that relates to my live site’s address. I DO NOT have any redirect plugins. And I did restart the MAMP server after making changes to see if that would help.

    To export (backup) my database, I used the following instructions, with the exception of excluding the wp_options table:

    To move my database, I followed these instructions as best as I could (I cannot login to the local version of WP, since it redirects me to the live login page, and I am not moving any files since I’m trying to test the database):

    If it helps, my site is

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hey, did you try logging in via /wp-login.php – if you can get in there try refreshing permalinks and see if that sorts you out.

    This might help as well –

    I am facing the same difficulty, I manipulated the database for siteurl and home still it redirects. Tried multiple ways given in codex. Functions.php way, wp-config.. evrything.
    Still it is redirecting. Just the admin pages and login pages.

    If you are trying to copy a live site to MAMP, this works first time, every time for me 🙂

    Live Site:

    – export the live db and download
    – Compress (ZIP) the entire live site and download

    MAMP (assuming a default MAMP installation):

    – start MAMP (both icons green)
    – create a new, empty db (use the same name as live to make things easier) and import into it the live db
    – edit the wp-options siteurl and home fields with the MAMP url (http://localhost:8888 for a “root” install; add / plus the folder name if installed in a folder in the root)
    – extract the live ZIP into the desired MAMP location (root or folder)
    – edit the wp-config.php for the MAMP db credentials (user and pwd = root and root for a default MAMP installation)
    – login to the WP dashboard, install and run this plugin:

    – download and run this script:

    Database Search and Replace Script in PHP

    – re-save your permalinks
    – done 🙂 … works every time for me 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Set up test site, and wp-admin redirects to live site’ is closed to new replies.