🚀 How to Set Up a Virtual Host in XAMPP (C:) to Run WordPress from Another Drive (G:)

1. Install XAMPP(Already Installed)

Make sure Apache and MySQL modules are running from the XAMPP Control Panel.

2. Download/Edit WordPress on G:

Extract WordPress, say, to G:\wordpress.

3. Create a Database for WordP…


This content originally appeared on DEV Community and was authored by Pranto Mollick

1. Install XAMPP(Already Installed)

Make sure Apache and MySQL modules are running from the XAMPP Control Panel.

2. Download/Edit WordPress on G:

Extract WordPress, say, to G:\wordpress.

3. Create a Database for WordPress

4. Set Permissions (if needed)

Make sure your user account has read/write permissions for G:\wordpress.

5. Configure Apache Virtual Hosts

a. Edit httpd-vhosts.conf:

  • Open C:\xampp\apache\conf\extra\httpd-vhosts.conf with a text editor (running as Administrator).
  • Add a block like this at the end:
<VirtualHost *:80>
    ServerName gamestore-dev.local
    ServerAlias gamestore-dev.local
    DocumentRoot "G:/wordpress"
    <Directory "G:/wordpress">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require all granted
    </Directory>
    ErrorLog "logs/dummy-host2.example.com-error.log"
    CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>

Replace mywordpress.local with your desired local domain.

b. Ensure mod_vhost and mod_rewrite are Enabled

  • In C:\xampp\apache\conf\httpd.conf, make sure these lines are uncommented (no #):


Include "conf/extra/httpd-vhosts.conf"
LoadModule rewrite_module modules/mod_rewrite.so

6. Edit Your hosts File

  • Open Notepad as Administrator.
  • File > Open: C:\Windows\System32\drivers\etc\hosts
  • Add this line at the end:
    127.0.0.1   mywordpress.local

7. Restart Apache

  • In the XAMPP Control Panel, stop and start Apache.

8. Install WordPress

  • Visit http://mywordpress.local in your browser.
  • Run the installation wizard.
  • Enter your database info: > - Database Name: wordpress_db > - Username: root > - Password: (leave blank unless you set one)

9. Test

  • You should see the WordPress setup page from G:\wordpress.
  • Log in to your WordPress site as normal.

Tip:
For multiple projects, just replicate the block with different folders and domain names.


This content originally appeared on DEV Community and was authored by Pranto Mollick


Print Share Comment Cite Upload Translate Updates
APA

Pranto Mollick | Sciencx (2025-08-18T09:59:44+00:00) 🚀 How to Set Up a Virtual Host in XAMPP (C:) to Run WordPress from Another Drive (G:). Retrieved from https://www.scien.cx/2025/08/18/%f0%9f%9a%80-how-to-set-up-a-virtual-host-in-xampp-c-to-run-wordpress-from-another-drive-g/

MLA
" » 🚀 How to Set Up a Virtual Host in XAMPP (C:) to Run WordPress from Another Drive (G:)." Pranto Mollick | Sciencx - Monday August 18, 2025, https://www.scien.cx/2025/08/18/%f0%9f%9a%80-how-to-set-up-a-virtual-host-in-xampp-c-to-run-wordpress-from-another-drive-g/
HARVARD
Pranto Mollick | Sciencx Monday August 18, 2025 » 🚀 How to Set Up a Virtual Host in XAMPP (C:) to Run WordPress from Another Drive (G:)., viewed ,<https://www.scien.cx/2025/08/18/%f0%9f%9a%80-how-to-set-up-a-virtual-host-in-xampp-c-to-run-wordpress-from-another-drive-g/>
VANCOUVER
Pranto Mollick | Sciencx - » 🚀 How to Set Up a Virtual Host in XAMPP (C:) to Run WordPress from Another Drive (G:). [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/08/18/%f0%9f%9a%80-how-to-set-up-a-virtual-host-in-xampp-c-to-run-wordpress-from-another-drive-g/
CHICAGO
" » 🚀 How to Set Up a Virtual Host in XAMPP (C:) to Run WordPress from Another Drive (G:)." Pranto Mollick | Sciencx - Accessed . https://www.scien.cx/2025/08/18/%f0%9f%9a%80-how-to-set-up-a-virtual-host-in-xampp-c-to-run-wordpress-from-another-drive-g/
IEEE
" » 🚀 How to Set Up a Virtual Host in XAMPP (C:) to Run WordPress from Another Drive (G:)." Pranto Mollick | Sciencx [Online]. Available: https://www.scien.cx/2025/08/18/%f0%9f%9a%80-how-to-set-up-a-virtual-host-in-xampp-c-to-run-wordpress-from-another-drive-g/. [Accessed: ]
rf:citation
» 🚀 How to Set Up a Virtual Host in XAMPP (C:) to Run WordPress from Another Drive (G:) | Pranto Mollick | Sciencx | https://www.scien.cx/2025/08/18/%f0%9f%9a%80-how-to-set-up-a-virtual-host-in-xampp-c-to-run-wordpress-from-another-drive-g/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.