Support the ongoing development of Laravel.io →
Configuration Views Installation

Hi everyone

I've an annoying issue. I have a prefix route => mydomain.com/app/ and when I go to this link it shows me the application. But If I want to go to this link => mydomain.com/app/contact then I have a 404 error.

I can't figure it out, does anyone know how to solve this?

##web.php

 Route::get('/contact', function() {
     return "hallo";
 });

##.htaccess

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
    Options -MultiViews
</IfModule>
RewriteEngine On
RewriteBase /app/

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [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>

##nginx.conf

location /app {
        alias /folder/to/laravel/public;
        index index.php index.html index.htm;

            location ~ \.php$ {
                include ./fastcgi.conf;
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_param SCRIPT_FILENAME $request_filename;
            }

     # try_files $uri $uri/ /index.php;
    }

Thanks!

Last updated 3 years ago.
0

Try removing the leading slash:

 Route::get('contact', function() {
     return "hallo";
 });
0

It still returns a 404 error page.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

yawuar yawuar Joined 18 Apr 2017

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.