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?
Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.
Serve both sites from the same installation.
wp-config.php include the settings depending on
Example for a complete
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__ ) . '/' );
.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.com.config.php you can move these to the main file, the authentication keys and salts for example or basic DB constants.