Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

266
Visualizações
Laravel on Apache - wrong URLs

I have deployed Laravel on Apache server, but got problem with wrong URLs.

The app directory is /var/www/laravel, but I only get access on it at:

http://127.0.0.1/laravel/public/index.php

On URL http://127.0.0.1/laravel I see tree of project files, on http://127.0.0.1/laravel/public I get message

Not Found
The requested URL was not found on this server.

What I want to achieve is to get access via http://127.0.0.1/laravel to my app.

.htaccess file:

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

    RewriteEngine On

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

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Send Requests To Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

/etc/httpd/conf/httpd.conf v-host configuration:

<VirtualHost 127.0.0.1/laravel:80>
        ServerName 127.0.0.1
        ServerAlias localhost
        DocumentRoot /var/www/laravel/public
        <Directory /var/www/laravel/public>
                Options Indexes FollowSymLinks
                AllowOverride All
                Require all granted
        </Directory>
</VirtualHost>

What I want mention is that I use CentOS 8 and I want to host more that 1 project on it.

What I do wrong?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

This will listen for any IP address on port 80 including local host IP 127.0.0.1. Set up a different virtual host for access by domain name instead of IP address.

<VirtualHost *:80>

        DocumentRoot /var/www/main

        <Directory /var/www/main>

                Options Indexes FollowSymLinks
                AllowOverride All
                Require all granted

        </Directory>

</VirtualHost>
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda