The best way is to create VirtualHost for each project you develop. Otherwise, you will need to modify the DocumentRoot for the project that you are developing at that time.
Thus, you can modify the "httpd-vhosts.conf" file and create a VH for port 80 by redirecting all requests to VH for port 443 (if you want to disable only HTTP), for example like this:
• HTTP
<VirtualHost *:80> ServerName yoursite.your.domain Redirect / https://yoursite.your.domain/ </VirtualHost>
• HTTPS
<VirtualHost *:443> ServerName yoursite.your.domain:443 #in your case you're not using htdocs, so DocumentRoot be like DocumentRoot "C:\xampp\yourproject" <IfModule mod_headers.c> Header set Access-Control-Allow-Origin "*" Header always set Access-Control-Allow-Methods "POST, PUT, GET, DELETE, OPTIONS" Header always set Access-Control-Allow-Headers "Content-Type" </IfModule> #the same here <Directory "C:\xampp\yourproject"> Options +Indexes +Includes +FollowSymLinks +MultiViews AllowOverride All Require all granted </Directory> #check your absolute path bellow SSLEngine on SSLCertificateFile "C:\xampp\apache\conf\ssl.crt\server.crt" SSLCertificateKeyFile "C:\xampp\apache\conf\ssl.key\server.key" </VirtualHost>
As for the certificate, I think that XAMPP actually comes with a built-in SSL certificate, but even if it did not come, you can generate it using its tools. You can see many lessons on the Internet about this.
source share