Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

265
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!