1

Just installed an existing WordPress on my localhost (MAMP) to check for a few images issues.

However, when I visit:

localhost:8888/wordpress/

I'm redirected to:

localhost/wordpress/

Which is not the path to my files anymore.

I've checked for any possible redirection in my .htaccess but it was empty. Where could this be coming from? I've tried to change port as well, but it was the exact same behavior.

1

There are a few variables that need to be changed in order for you to update to the new link on your WordPress site since you mention that you've installed an existing WordPress site that has already been set up.

Try the following steps using the Search Replace DB tool:

  1. Go and download Interconnect IT's Database Search & Replace Script here
  2. Unzip the file and drop the folder in your localhost where your WordPress is installed (the root) and rename the folder to replace (screenshot)
  3. Navigate to the new folder you created in your browser (ex: http://localhost:8888/wordpress/replace) and you will see the search/replace tool
  4. Enter your old URL in the search for… field and the new URL in the replace with… field, like so:
    • Search: localhost/wordpress
    • Replace: localhost:8888/wordpress

You can click the dry run button under actions to see what it will be replacing before you execute the script. Once you're done be sure to remove the /replace/ folder.

  • Well I guess it's a good point, I'm not redirect anymore to localhost. – Baldráni Sep 16 '16 at 8:04
  • If this solved your question, be sure to click the checkmark next to my answer to indicate that this question has been resolved. – Ethan Jinks O'Sullivan Sep 16 '16 at 11:10
0

Wordpress defines a static value for the site url after installation. This data is stored in the database. However you can override this value with constants in your ./wp-config.php or you can change the value in the option table at your database of course. I usually go for the first option, I define the constant with a dynamic value. So it also works with domain aliases.

0

If you’re moving your site from one server to another and changing the URL of your WordPress installation, the approach below allows you to do so easily without affecting the old site:

Backup the database on your current site Install the database on your new host On the new host, define the new site URL in the wp-config.php file,

Log in at your new admin URL and run Better Search Replace on the old site URL for the new site URL Delete the site_url constant you added to wp-config.php. You may also need to regenerate your .htaccess by going to Settings -> Permalinks and saving the settings.

USE this plugin: https://wordpress.org/plugins/better-search-replace/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.