Thursday, September 18, 2025

#2 multiple wp sites

 Great question πŸ‘ Setting up multiple WordPress sites in the same XAMPP is very useful if you want to test many projects. You can do this in two ways:

  1. Simple way (different folders under htdocs)

  2. Professional way (virtual hosts with custom domain names like site1.local, site2.local)

I’ll explain both.


✅ Method 1: Simple way (easiest)

  1. Go to:

    C:\xampp\htdocs\
    
  2. Create a new folder for each WordPress project:

    C:\xampp\htdocs\project1
    C:\xampp\htdocs\project2
    
  3. Copy the WordPress files into each folder.

  4. Create a separate database for each project in phpMyAdmin:

    • wordpress_db1 for Project1

    • wordpress_db2 for Project2

  5. Install each site by visiting in browser:

    • http://localhost/project1

    • http://localhost/project2

⚡ That’s it. Each WordPress site is independent.


✅ Method 2: Virtual Hosts (cleaner, looks like real websites)

This way, you can use custom local domains instead of localhost/project1.

Step 1: Create project folders

Put your sites in htdocs:

C:\xampp\htdocs\site1
C:\xampp\htdocs\site2

Step 2: Create databases

  • site1_db for Site1

  • site2_db for Site2

Step 3: Edit httpd-vhosts.conf

  1. Open this file in Notepad (as Admin):

    C:\xampp\apache\conf\extra\httpd-vhosts.conf
    
  2. Add entries for each site:

    <VirtualHost *:80>
        ServerName site1.local
        DocumentRoot "C:/xampp/htdocs/site1"
        <Directory "C:/xampp/htdocs/site1">
            AllowOverride All
            Require all granted
        </Directory>
    </VirtualHost>
    
    <VirtualHost *:80>
        ServerName site2.local
        DocumentRoot "C:/xampp/htdocs/site2"
        <Directory "C:/xampp/htdocs/site2">
            AllowOverride All
            Require all granted
        </Directory>
    </VirtualHost>
    

Step 4: Edit hosts file

  1. Open (as Admin):

    C:\Windows\System32\drivers\etc\hosts
    
  2. Add:

    127.0.0.1   site1.local
    127.0.0.1   site2.local
    

Step 5: Restart Apache

  • Open XAMPP Control Panel → restart Apache.

Step 6: Install WordPress

Now you have multiple local sites running like real domains πŸŽ‰


πŸ‘‰ Do you want me to write a step-by-step full config file example for 2 WordPress sites (site1.local + site2.local), so you can copy-paste and run directly?

Perfect πŸ‘ I’ll give you a ready-to-use setup for 2 WordPress sites (site1.local and site2.local) inside XAMPP on Windows.


πŸ”Ή Step 1: Create Site Folders

Go to:

C:\xampp\htdocs\

Create:

C:\xampp\htdocs\site1
C:\xampp\htdocs\site2

Unzip WordPress into both folders.


πŸ”Ή Step 2: Create Databases

  1. Open http://localhost/phpmyadmin/

  2. Create 2 databases:

    • site1_db

    • site2_db


πŸ”Ή Step 3: Configure Virtual Hosts

  1. Open (with Notepad as Admin):

    C:\xampp\apache\conf\extra\httpd-vhosts.conf
    
  2. Add this code at the bottom:

# Site1 Configuration
<VirtualHost *:80>
    ServerName site1.local
    DocumentRoot "C:/xampp/htdocs/site1"
    <Directory "C:/xampp/htdocs/site1">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

# Site2 Configuration
<VirtualHost *:80>
    ServerName site2.local
    DocumentRoot "C:/xampp/htdocs/site2"
    <Directory "C:/xampp/htdocs/site2">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

✅ Make sure the paths match your real folder names.


πŸ”Ή Step 4: Map Domains in hosts File

  1. Open (as Admin):

    C:\Windows\System32\drivers\etc\hosts
    
  2. Add at the end:

127.0.0.1   site1.local
127.0.0.1   site2.local

πŸ”Ή Step 5: Restart Apache

  • Open XAMPP Control Panel → Stop & Start Apache.


πŸ”Ή Step 6: Install WordPress

Install each site normally → set username, password, and site title.


✅ Now you have two completely separate WordPress sites on your local system:


πŸ‘‰ Do you want me to also give you a template for adding more sites (site3, site4, etc.), so you can just copy-paste when needed?

No comments:

Post a Comment

#8 Make WP Theme

 Perfect πŸ‘ Let’s upgrade the minimal theme with all the “nice-to-have” Astra-like enhancements so it feels more professional, flexible, an...