How to Change the Web Server Folder Location In XAMPP?

7 minutes read

To change the web server folder location in XAMPP, you need to follow these steps:

  1. Locate and open the XAMPP installation directory on your computer.
  2. Find and open the "httpd.conf" file within the "conf" folder.
  3. Look for the following line: "DocumentRoot "C:/xampp/htdocs"".
  4. Change the path inside the quotes to your desired folder location. For example, if you want to set the new folder location to "D:/web", modify the line to: "DocumentRoot "D:/web"".
  5. Further down the file, locate the line: "".
  6. Again, replace the existing path with your desired folder location. Using the previous example, the modified line will be: "".
  7. Save the changes made to the "httpd.conf" file.
  8. Restart the Apache server to apply the modifications.
  9. Now, XAMPP will use the new folder location as the root directory for your web server. Place your website files and folders in the designated location for the changes to take effect.

Best Cloud Hosting Providers in 2024

1
Vultr

Rating is 5 out of 5

Vultr

  • Ultra-fast Intel Core
  • High Performance and Cheap Cloud Dedicated Servers
  • 1 click install Wordpress
  • Low Price and High Quality
2
Digital Ocean

Rating is 5 out of 5

Digital Ocean

  • Active Digital Community
  • Simple Control Panel
  • Starting from 5$ per month
3
AWS

Rating is 5 out of 5

AWS

4
Cloudways

Rating is 5 out of 5

Cloudways


How to restart the Apache web server after changing the folder location in XAMPP?

To restart the Apache web server after changing the folder location in XAMPP, follow these steps:

  1. Open the XAMPP control panel by searching for "XAMPP control panel" in the Start menu or by navigating to the XAMPP installation directory and running "xampp-control.exe".
  2. Stop the Apache web server by clicking on the "Stop" button next to Apache in the control panel.
  3. After Apache has stopped, click on the "Config" button next to Apache to open the Apache configuration file (httpd.conf) in a text editor.
  4. In the configuration file, search for the line that contains the "DocumentRoot" directive. This line specifies the folder location that Apache serves files from.
  5. Change the folder location to the desired new location. For example, change "DocumentRoot "C:/xampp/htdocs"" to "DocumentRoot "D:/new/location"".
  6. Also, find the line with the "" directive that corresponds to the previous DocumentRoot location and update it to reflect the new location. For example, change ":/xampp/htdocs">" to "".
  7. Save the changes to the configuration file and close the text editor.
  8. Go back to the XAMPP control panel and click on the "Start" button next to Apache to start the web server with the new folder location.


After following these steps, Apache will restart with the new folder location specified in the configuration file. You should now be able to access your files from the updated location.


How to enable SSL (HTTPS) for the web server in XAMPP?

To enable SSL (HTTPS) for the web server in XAMPP, follow these steps:

  1. Download and install OpenSSL (if it's not already installed on your system).
  2. Open the XAMPP Control Panel and stop the Apache server, if it's running.
  3. Open a Command Prompt (CMD) with administrator privileges.
  4. Navigate to the XAMPP installation directory using the "cd" command. For example, if XAMPP is installed in the "C:\xampp" directory, you would use the command: cd C:\xampp
  5. Generate a self-signed SSL certificate using the following command: openssl req -newkey rsa:2048 -nodes -keyout etc\ssl\private.key -x509 -days 365 -out etc\ssl\certificate.crt This command will generate a private key and an SSL certificate, which will be valid for 365 days. You can change the number of days as per your requirement.
  6. Update the Apache configuration file ("httpd.conf") to include the SSL certificate and key. Open the file using a text editor.
  7. Search for the following lines: #LoadModule ssl_module modules/mod_ssl.so #LoadModule socache_shmcb_module modules/mod_socache_shmcb.so Uncomment these lines by removing the "#" at the beginning.
  8. Search for the following lines: #Include etc/extra/httpd-ssl.conf Uncomment this line by removing the "#" at the beginning.
  9. Save the changes and close the file.
  10. Open the "httpd-ssl.conf" file, located in the "extra" directory of your XAMPP installation, using a text editor.
  11. Locate the following lines: SSLProtocol all -SSLv2 -SSLv3 SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5:!RC4 Uncomment these lines by removing the "#" at the beginning if they are commented out.
  12. Find the following lines: DocumentRoot "${SRVROOT}/htdocs" Replace these lines with the path to your web server's document root directory. For example: DocumentRoot "C:/xampp/htdocs"
  13. Save the changes and close the file.
  14. Start the Apache server from the XAMPP Control Panel.
  15. Open your web browser and enter "https://localhost" in the address bar. You should now see a security warning since you're using a self-signed certificate. Proceed to bypass the warning and you should now see the secure version of your web server.


Note: It's recommended to obtain a valid SSL certificate from a trusted certificate authority (CA) for production environments instead of using self-signed certificates.


How to access the XAMPP control panel?

To access the XAMPP control panel, follow these steps:

  1. Open the XAMPP installation directory. The default installation directory on Windows is "C:\xampp".
  2. In the installation directory, locate and run the "xampp-control.exe" file. This is the control panel executable.
  3. The XAMPP control panel should now open. It provides a GUI (Graphical User Interface) to control various aspects of the XAMPP server.
  4. Use the control panel to start, stop, and manage the Apache HTTP Server, MySQL database server, FileZilla FTP server, and other components included in XAMPP.
  5. You can also access the XAMPP control panel directly by entering "localhost/dashboard" or "127.0.0.1/dashboard" in your web browser. This will bring up the XAMPP dashboard, from where you can navigate to the control panel.


Note: The steps may vary slightly depending on your operating system.

Facebook Twitter LinkedIn Telegram Whatsapp Pocket

Related Posts:

Starting the XAMPP control panel is a simple process. After installing XAMPP on your computer, follow these steps:Open the XAMPP installation folder on your computer. The default installation location is usually "C:\xampp" on Windows or "/Applicati...
To add Python to XAMPP, follow these steps:Download and install XAMPP from the official Apache Friends website.Download and install Python from the official Python website.Open the XAMPP installation folder (usually located in C:\xampp).Locate the "xampp-c...
To create a simple PHP file and run it in XAMPP, follow these steps:Install XAMPP: Download and install XAMPP from the Apache Friends website (https://www.apachefriends.org/index.html). Choose the appropriate version for your operating system. Start XAMPP: Lau...