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__ ) . "https://wordpress.stackexchange.com/" );
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.
Related Posts:
- How to point my domain to a WordPress install in a sub-directory?
- How would you detect if WordPress is installed in a subdirectory (not root)?
- 2 WordPress sites in 2 sibling folders on one domain
- Index (Home) page not displayed when running wordpress in a subdirectory
- PHP – Move a file into a different folder on the server
- Compare 2 directories in windows
- get_template_directory() vs bloginfo( ‘template_directory’ ) vs TEMPLATEPATH
- Change upload directory for PDF files
- What’s the purpose of index.php in wp-content directory? [duplicate]
- How do I serve static content on same domain as WordPress
- How to Create Hierarchical Directory for Nation Wide Mental Health Services
- How to create new folder in wp-content root same like upload folder?
- How do I set up single sign on for multiple WP installs across the same domain?
- Why doesn’t WP_PLUGIN_DIR definition use DIRECTORY_SEPARATOR?
- issues including a file from a plugin directory
- How is a student directory best handled in WordPress?
- Creating directory in uploads: mkdir vs wp_mkdir_p
- Cant get wordpress to work on subdirectory
- What is the recommend directory in which I can upload a new library?
- Second wordpress installation on subdirectory
- How to create an Online Dictionary Using WordPress? [closed]
- Include file from higher level
- how to create a folder in wordpress
- wordpress blog in subdirectory or subdomain
- Accessing WordPress installation in its own directory at domain root
- Right permissions to WordPress directory
- Can I install a new WordPress site inside a sub-directory of an existing WordPress site?
- Template Hierarchy tag-{slug}.php directory
- more than one upload directory?
- Change directory of javascript files
- Theme in wp-content but my index.php search theme files in root
- get_query_var not working for subdirectory
- How can I have nginx serve WordPress at /blog?
- Subdomain redirects to subdirectory [closed]
- How to make use of WP templates within a nested site structure?
- Plugins will only be installed with 777 on folder. Solution?
- How to create directory using username within theme
- Main WP page and subfolder WP with the same name. How to prioritize for main Wp
- Session Expired when WordPress Address (URL) and Site Address (URL) are different
- After changing wp from subdirectory to root I can’t preview any changes to a page or post
- Moving from one test to multiple final environments
- WordPress in a sub directory but not images
- Should I install blog on subdomain or subdirectory?
- Moving WP from /blog to root directory
- Should custom directories be created under the wp-content directory?
- Use of Folders within WordPress
- Folder keeps popping up in my public_html directory and overriding WordPress page structure
- Hosting my WordPress site out of a subdirectory
- Theme file structure best practice
- Clean installation missing its /wp-content folder
- Path in dev server works; same path in prod server is broken
- What is wp-admin/meta for?
- Multisite – One Site with multiple URLs
- What plugins create a directory on the root directory of WordPress? [closed]
- How can i shift my chosen posts to a subdirectory?
- Where to put robot.txt and sitemap.xml for wordpress installed in its own directory
- Automating WP application directory creation (domain name passed as a variable argument)
- How to disable directory files from accessing?
- Move WordPress from Root to Subfolder
- WordPress not handling subdirectory properly
- Wp-CLI not working with WordPress installed with composer
- How to visit php file in my custom directory under site root directory
- WordPress File Structure
- Getting Internal server in sub folder pages
- Impossible to index an upload folder with 10k files
- Moving wordpress from /dir to main folder
- Giving WordPress Its Own Directory together with index.html
- Upload an image at frontend > Create direction and/or rename filename possible?
- wordpress sub-directory sites on a sub-domain?
- Want to change my site root
- How to move a WordPress installation to a subdirectory
- Is there a way to create folders restricted to specific users to open?
- add 360 (non-WordPress) tours in a subfolder with the same name as the main (WordPress)page of the 360 tours
- WordPress page for one specific page on Google Cloud hosted website?
- WordPress hosted on subfolder of domain causing customizer to constantly refresh and is requesting jquery from root domain
- Error in the paths of one of the plugins when changing the plugin directory
- Serve WordPress site as root domain with WordPress files in subdirectory in nginx server
- Editing Listings in a Business Directory
- How to install WordPress on sub directory in ubuntu 16.4 in same vhost with AngularJS
- Bedrock WordPress retro-porting to standard WP installation: is this allowed?
- I need advice for creating native WordPress directory site based on native WordPress functionality only
- Rrestrict access to static pages if user is not logged in
- Permalink issue with WordPress Site at domain root and another WordPress Site in a Subfolder
- Change the WordPress files structure
- Do I need to be selective about where I search and replace when pointing a domain to a subfolder used for development?
- Downloadable content file structure
- WordPress makes 404 error when going to domain folder
- Moving wp-config.php when you have a second wordpress install
- Using same root header in subfolder wp blog – Header disapears on Single Posts
- Run multiple installs using the same wp-admin & wp-includes?
- WordPress on Azure as Subdirectory
- Create Subfolder that always displays template file
- FTPS Uploads – wp-content cannot be found
- How do you create a development site into a subdirectory of the live site?
- The right way to go about creating a WordPress site from a static site which has WordPress installs in its subdirectory
- Plugin could not be deleted due to an error: Unable to locate WordPress Plugin directory
- Moving wordpress from TLD to sub-folder (URL structure only)
- @font-face Paths Don’t Seem to be working properly
- Multisite Sub-directories Installation
- Could moving my WordPress installation from /var/www/html/ to /var/www/ break the application?