WordPress – How to set up proxy reverse with wordpress

apache-2.2reverse-proxyWordpress

I have a wordpress site running on http://www.testdomain.com

now I want to change it to http://productiondomain.com/Branch (I dont have control of this server at all. they set it up for us)

So right now when I visit http://productiondomain.com/Branch I get redirected to http://www.testdomain.com (which is not what I want. I want the url to remain http://productiondomain.com/Branch at all times.

Im pretty sure there is something I have to change in wordpress settings and in .htaccess file or in Apache config but Im really clueless in this area.

Please help.

Best Answer

You will need to ask the MySQL db administration at productiondomain.com to change some values in your wordpress database there.

Lets assume your wordpress database is called wordpress_db. In this case you have to ask him to run the following two queries (first change the options according to your needs)

UPDATE `wordpress_db`.`wp_options` SET `option_value` = 'http://productiondomain.com/Branch' WHERE `wp_options`.`option_name` = `siteurl`;
UPDATE `wordpress_db`.`wp_options` SET `option_value` = 'http://productiondomain.com/Branch' WHERE `wp_options`.`option_name` = `home`; 

Alternatively you can add the following two lines to your wp-config.php file (again if you don't have access on the files of productiondomain.com, ask the admin there to do it for you)

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

There are also other ways, like adding two lines of code to your functions.php file, but one of the above two will do.

More information can be found here

Related Topic