Error 404 in project

Asked

Viewed 189 times

0

I have some settings in the file config/app.php of my project, as:

'base_domain' => 'aplicacao.com.br'
'url' => env('APP_URL', 'https://cliente.aplicacao.com.br')

In my route files, I have:

Route::domain('cliente.' . config('app.base_domain'))->group(function () {...

I configured a virtual host (with xampp), which has the following configuration:

<VirtualHost *:80>
    ServerName www.aplicacao.com.br
    ServerAlias aplicacao.com.br
    DocumentRoot "meu diretório"
    <Directory "meu diretório">
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Require all granted 
    </Directory>
</VirtualHost>

When accessing the application by the browser, it never finds the views, always gives the 404 error (as if it was not finding the domain). Is my setup wrong? Would you have to set up something else?

1 answer

1

You cannot appropriate a domain .with.br and simply set it up on your apache server as a virtual host, it doesn’t work.

For this purpose you wish to exist the domains .test. To configure this domain in Windows do the following:

  1. Access C:\Windows\System32\drivers\etc.

  2. Edit the file hosts with the text editor you prefer, it can be the notepad.

  3. Assuming you want to create the domain test application., will leave the file with the following content:

    #
    127.0.0.1 localhost
    ::1 localhost
    127.0.0.1 aplicacao.test
    ::1 aplicacao.test
    
  4. With this you will have registered this local domain on your operating system.

Now also modify your virtual server:

<VirtualHost *:80>
    ServerName aplicacao.test
    ServerAlias www.aplicacao.test
    DocumentRoot "meu diretório"
    <Directory "meu diretório">
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Require all granted 
    </Directory>
</VirtualHost>

In this file it is worth making some reservations. The first is the ServerAlias is that has the www of the dome, the ServerName is the pure domain. The second is, when you write the "my directory" described there, note that in DocumentRoot the directory does not have the character /(bar) at the end and tag Directory yes must have the character /(bar) at the end of the path.

Do this and restart your apache (in your case xampp). Adjust the files in Laravel to this new domain and should work properly.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.