Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've done my share of searching, but apparently my search-fu is failing me, because I haven't found anything that really seems to fit my circumstance. Also, I don't want to just try random solutions and end up bricking everything.

I have a client who has previously managed her site and installations herself and has now hired me on to take things over.

Currently there is one hosting account with two domains.

The host is GoDaddy. It's a Deluxe linux account.

  • There is a Wordpress installation in the root directory of the account, currently serving domain1.com
  • There is a second Wordpress installation in a directory (domain1.com/domain2). This install is suppose to be serving domain2.com. Which it does, but it's also posing a bunch of problems.

Under the installation for domain2.com ( installed in domain1.com/domain2 ), I can't change the permalink settings to anything but default with out breaking the entire site.

  • Changing the permalink settings results in the warning that Wordpress can't write to .htaccess. Despite the .htaccess permissions being set to 644 (I even tried 777).
  • So I manually edited the .htaccess file to Wordpress's generated content.
  • This results in the site 'breaking'. The front page shows some default content that I don't recognize and none of the links result in pages being loaded. Just the default 'page not found'.

Under the General settings the install is set to:

WordPress Address (URL) : http://www.domain1.com/domain2
Site Address (URL) : http://www.domain2.com

IS it possible to successfully run two separate domains from two separate Wordpress installs, under the same hosting account, with out switching everything over to a network?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Serve both sites from the same installation.

In your wp-config.php include the settings depending on $_SERVER['HTTP_HOST'].

Example for a complete wp-config.php:

define( 'DB_HOST',     'localhost' );
define( 'DB_CHARSET',  'utf8' );
define( 'DB_COLLATE',  'utf8_general_ci' );

if ( 'example.net' === $_SERVER['HTTP_HOST'] ) // .net domain
    include 'example.net.config.php';
elseif ( 'example.com' === $_SERVER['HTTP_HOST'] ) // .com domain
    include 'example.com.config.php';
else
    die( 'something went wrong' ); // improve this error message

defined( 'ABSPATH' ) || define( 'ABSPATH', dirname( __FILE__ ) . '/' );

The .htaccess rewrite rules for single site installations are always the same, so don’t worry about conflicts.

If there are some identical settings in example.net.config.php and example.com.config.php you can move these to the main file, the authentication keys and salts for example or basic DB constants.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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