2

I have a self hosted wordpress website hosted on Digital Ocean,setup as a subdomian; ubuntu server running apache. I am trying to setup a development server to test out plugin changes and wordpress upgrades. I want the data to mirror the main site. To do this I dumped the wordpress database using mysqldump. On the test server I imported this, also duplicating the wp database username and credentials.

Now, for some reason, when I go to the test url address, the wordpress site redirects the url to the test server ip address. There other people who have had this issue; and I have tried these suggested solutions:

  • Update the site url in the wp-admin. I can access wp-admin, but the fields to do this update are greyed out
  • remove OR having the statically defined WordPress Address (URL) and Site Address (URL) in the wp-config. I tried both ways, nonthing.
  • Update the database directly with the new url. I used http://codepen.io/EightArmsHQ/full/nzEjI
  • Clear browser cache and user a private browsing tab.
  • If I do a fresh install of wordpress on the server, it does not redirect

I also, verified there is no dns record issue, because, I replaced the site with a simple 'hello world' index.php, and the test url stays. As for apache, I defined this in a sites-enabled file:

<VirtualHost *:80>
         ServerName test.mymainwebsite.com
         DocumentRoot /var/www
</VirtualHost>

I am opened to suggestions from the community on how you setup your test servers. Maybe I'm just going about this the wrong way. I still would like input on why this could be happening.

1

1 Answer 1

3

Try adding this code to your wp-config.php file:

define( 'WP_SITEURL', 'http://example.com' );
define( 'WP_HOME', 'http://example.com' );

It will override any values in database. Also, check if siteurl and home keys in wp_options table are correctly set.

2
  • Thanks. That worked. I was also able to eventually get it to work by replacing all references to the ip address and domain in the sql export of the database.
    – paxamus
    Apr 8, 2015 at 2:47
  • I realize this comment is ancient, but note that the problem will continue if you specify https when your Wordpress instance sits behind a load balancer and the actual connection to it is not via TLS/SSL. Apr 21 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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