Ask your WordPress questions! Pay money and get answers fast! (more info)

Can I wildcard the URL for the site? WordPress

I am at a company right now, we just put a new, blank copy of WordPress into Subversion. Each programmer and each front end person is checking it out from Subversion and working on it. We've got 5 people working on it. Unfortunately, the field in the database that has the URL for the front page is causing problems. It keeps redirecting to a fixed URL, rather than each person's own home url (their local url in the own sandbox). Can we wildcard this URL somehow?

Answers (3)

2011-03-21

Jarret Minkler answers:

How is the dev's database setup? Each dev should be using their own config file that should not be checked in. Rename the original config adding a .orig and in your prod build process rename this file to without the .orig

If you do the below answers, also be sure to include $_SERVER['SERVER_PORT'] as well as the HOST

:)

2011-03-21

Oleg Butuzov answers:

Just filter the home option by current site URL.


Oleg Butuzov comments:

add_filter('option_siteurl', 'filter_home');
add_filter('option_home', 'filter_home');

function filter_home($s){
return 'http://'.$_SERVER['HTTP_HOST'];
}


Oleg Butuzov comments:

into functions.php of the theme please.

2011-03-21

Utkarsh Kukreti answers:

Add this to your config.php file.


$url = 'http://' . $_SERVER['HTTP_HOST'] . str_replace('index.php', '', $_SERVER['SCRIPT_NAME']);
define('WP_HOME', $url);
define('WP_SITEURL', $url);