最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

localhostwp-admin on my local redirects to production site's wp-admin

programmeradmin2浏览0评论

So when I go on localhost, my development environment loads fine. But when I try to go to /wp-admin, I get redirected to the production URL mysite/wp-admin. Where is this being set? I don't want to be redirected.

So when I go on localhost, my development environment loads fine. But when I try to go to /wp-admin, I get redirected to the production URL mysite/wp-admin. Where is this being set? I don't want to be redirected.

Share Improve this question asked Jun 20, 2013 at 21:18 bigpotatobigpotato 3352 gold badges6 silver badges17 bronze badges 3
  • 1 Do you have phpmyadmin? Search for other site URL in entire database. Probably somewhere in options. – GhostToast Commented Jun 20, 2013 at 21:20
  • Yeh I do have it. I found it in options too, one called siteurl and one called home and a few more to specific paths. Which one do I change? – bigpotato Commented Jun 20, 2013 at 21:27
  • @Edmund Both. Changing just these two will suffice for basic operation on localhost, though links within posts & elsewhere will still point to production site. – TheDeadMedic Commented Jun 21, 2013 at 2:21
Add a comment  | 

4 Answers 4

Reset to default 3

You can find and replace instances of the old URL in your database but it's best to use a tool that handles serialized data such as BackupBuddy to avoid breaking things like some plugins. Hope this helps!

Use find and replace to find instances of your old URL and update to your new URL.

Here is a decent article on it.

http://codex.wordpress/Moving_WordPress

I wrote a little script that will create the necessary SQL code to put in phpmyadmin's SQL box (please backup DB first though)

http://tools.morningstarmediagroup/find-replace/

Note:

You'll just want to search for the top-level domain like so: http://example and replace with http://new.example - not a good idea to involve any trailing slash.

You can accomplish this by using WP CLI. Just run

wp search-replace old-domain new domain 

Too bad WP doesnt provide in-built configs for production and local envs like PHP frameworks. You'll have to change siteurl and home in wp_options to the production site URL

发布评论

评论列表(0)

  1. 暂无评论