Search code examples
phplaravelxampplocalhost

Problem with Virtual Host in XAMPP, project based on Laravel


I'm trying to start project in laravel on my lacalhost. This project is not mine, I work on it, and try to figured out how it was builded. There is main files:enter image description here

And in this files is laravel.core. He look's inside like this: enter image description here

In my XAMPP httpd-vhosts I have VirtualHost. Before every my project work fine without problem. In virtual host I create path to this main folder where the index.php is. But when in browser I try to open there is warning that this site is dangerous because it is self certificated, after that, there's only XAMPP Dashboard, nothing else.

In my index.php I have path:

require __DIR__.'/laravel_core/bootstrap/autoload.php';

And in above file I have:

require __DIR__.'/../vendor/autoload.php';

Edit:

So here is .htaccess:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{HTTPS} !=on
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

In index.php:

require __DIR__.'/laravel_core/bootstrap/autoload.php';

$app = require_once __DIR__.'/laravel_core/bootstrap/app.php';
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);

$response = $kernel->handle(
    $request = Illuminate\Http\Request::capture()
);

$response->send();

$kernel->terminate($request, $response);

In the bottom I add code from my .env, next from bootsrap/autoload.php and in the end from vendor/autoload.php:

APP_ENV=local
APP_KEY=base64:2OWwGrH6hL+4MKkV7sZZ21MTjSHv/zacUDC67FWVBa4=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=testowa1
DB_USERNAME=testowa1
DB_PASSWORD=password
DB_TABLE_PREFIX=cms_

define('LARAVEL_START', microtime(true));
require __DIR__.'/../vendor/autoload.php';

require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit7c0fb85d4a884560a3dba2e1e877f7b0::getLoader();

Solution

  • OK, This problem is solved by msg. He wrote in comment that problem is with VirtualHost, and when I removed this two mentioned lines in .htaccess, there is no more problem with showing XAMPP dashboard.