Apache virtual host always redirecting to /dashboard Apache virtual host always redirecting to /dashboard laravel laravel

Apache virtual host always redirecting to /dashboard


Ok, I'm not sure why this was an issue but it seems to work when I change the virtual host's server name to anything other than ".local".

Thanks again to all who replied!


Put this as the first line in C:\...\httpd-vhosts.conf (and restart the web server):

NameVirtualHost *:80

So, it should look like this:

NameVirtualHost *:80<VirtualHost *:80>    ServerName localhost    DocumentRoot "C:/xampp/htdocs"</VirtualHost><VirtualHost *:80>    ServerName walkpeakdistrict.local    DocumentRoot "C:/xampp/htdocs/walkpeakdistrict_uk/public"</VirtualHost>

I would place all my projects somewhere outside of C:/xampp/htdocs and C:/xampp. Let C:/xampp/htdocs be the standard localhost location, with just two files inside (simple index.php and index.html), but use another one for the projects. Even better, use another partition, not the system partition C:. Like D:/projects, or so. So, you would have D:/projects/walkpeakdistrict_uk.

Good luck.


I'm pretty sure the issue for me had to do with SSL redirects, for some reason. When I edited my .htaccess to exclude local.mydomain.com when forcing https, I stopped getting redirected to the XAMPP dashboard.

Below is the section of my .htaccess that excludes local sites from redirecting to https. You can add extra RewriteCond lines for other local domains.

<IfModule mod_rewrite.c>    RewriteEngine On    RewriteCond %{HTTP_HOST} !=localhost    RewriteCond %{HTTP_HOST} !local\.    RewriteCond %{HTTP_HOST} !other.localdomain.example.com    RewriteCond %{HTTPS} !=on    RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R,L]</IfModule><IfModule mod_headers.c>    RewriteEngine On    RewriteCond %{HTTP_HOST} !local\.    RewriteCond %{HTTP_HOST} !other.localdomain.example.com    Header set Strict-Transport-Security "max-age=16070400" env=HTTPS</IfModule>