I'm working on some edits for a client's site. So I downloaded the site's files and exported the database.
I need to make some big changes on a development machine first so I won't mess with the live site.
Then I imported the database to my development machine and setup the files as well. But whenever I go to http://localhost it redirects me to the client's site:
So since it redirects me to a https address I'm thinking it probably has something to do with that.
I did a global search on the code for the client's domain, but I don't see anything that redirects.
What could be the source of the redirecting? If the site doesn't stop redirecting, I can't work.
I'm working on some edits for a client's site. So I downloaded the site's files and exported the database.
I need to make some big changes on a development machine first so I won't mess with the live site.
Then I imported the database to my development machine and setup the files as well. But whenever I go to http://localhost it redirects me to the client's site: https://theclientsite
So since it redirects me to a https address I'm thinking it probably has something to do with that.
I did a global search on the code for the client's domain, but I don't see anything that redirects.
What could be the source of the redirecting? If the site doesn't stop redirecting, I can't work.
Share Improve this question asked May 9, 2012 at 19:58 leonelleonel 1872 silver badges7 bronze badges 3- Is there any evidence that this redirect is WordPress related? – Chip Bennett Commented May 9, 2012 at 20:07
- I asked my client if he installed any plugin that would do that and he said no. – leonel Commented May 9, 2012 at 20:10
- there is no .htaccess file either – leonel Commented May 9, 2012 at 20:10
3 Answers
Reset to default 3Usually, this is a problem with the Site URL or WordPress URL not being set properly. If you just copied the database, WordPress itself will try to redirect the domain back to what it thinks is the right site.
You have two options:
1. Edit the Settings
Use PHPMyAdmin or a similar tool to edit the site url and WordPress url settings in the database. This should fix the problem assuming nothing else on your development box is forcing the redirect.
2. Change your Hosts File
This is the better solution. Edit your hosts file to point http://clientsite
at your local IP address (127.0.0.1). Then, just navigate to the development site the same way you would the production site. Just remember to change your hosts file back when you're done developing.
I concur with EAMann that it is probably database-related. I, however, think the first solution is better than the second of the two provided. When I move WordPress installations (usually from development to production rather than the opposite, like you), I simply run a few UPDATE statements in phpMyAdmin. This is what I run:
update wp_posts set post_content = replace(post_content,'development','production');
update wp_posts set guid = replace(guid,'development','production');
update wp_options set option_value = replace(option_value,'development','production');
update wp_commentmeta set meta_value = replace(meta_value,'development','production');
Make sure you edit the URLs and table names according to your situation.
If you're into wp-cli this will do the trick in many cases:
wp search-replace example dev.example
Or if you're on localhost
:
wp search-replace example localhost
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745342675a4623399.html
评论列表(0条)