Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rojonunoo's avatar

The requested URL /login was not found on this server.

I keep getting this error after deploying my project . running Ubuntu 14.04 . routes are all working when i run them on development with Xamp but it wouldn't load the login page when i push to production. Please need a bit of help here .

0 likes
11 replies
kylevorster's avatar
  • Are you having issues with all your urls or just one?
  • Did you setup your .htaccess file?
<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # 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>

How does your routes file look for your login route ?

1 like
rojonunoo's avatar

so i have my .htaccess file just like yours. i tried running a simple test route since all my routes have middlewares of auth .. i tried running that and i had the same error but it works fine on my local machine. is there something i am missing somewhere

Rocky's avatar

@rojonunoo Have your production server mod_rewrite enabled? Maybe you are able to view the phpinfo with an simple php file?

phpinfo.php

<?php
phpinfo();
?>
1 like
jekinney's avatar

Yeah, xamp with laravel doesn't equal production environment. Hence why homestead or another vim/valet is recommended as it can closely mimic a deployment server where xamp can't.

More then likely you don't have your domain set to public/index.php and/or permission issues.

You running Apache or nginx? All your folders in the root or just public?

rojonunoo's avatar

@Rocky php info works fine like @jekinney said i think i have not set permissions to the public folder that should be the problem .so many threads online about giving permissions to I am also a bit confused cos i don't want to give all permissions to the public folder which i know is somewhat risky. Is there a standard way to set permissions for the public folder ?

Snapey's avatar
Snapey
Best Answer
Level 122

You don't need to, and you should not give permissions to public.

But you do need to ensure that public is the document root, i.e., if you put that phpinfo file into the public folder then it should be readable at http://domain.com/phpinfo.php

2 likes
dagfooyo's avatar

I'm having this same problem and none of the above solutions helped.

I deployed a brand-new Laravel project to my EC2 server and it shows up fine, but when I set up Auth it 404's when trying to view /login. Apache's serving the public directory fine because phpinfo loads just fine on the server as you can see: http://ec2-18-222-152-185.us-east-2.compute.amazonaws.com/info.php But the login 404's as you can also see: http://ec2-18-222-152-185.us-east-2.compute.amazonaws.com/login

What could be going on?

Cronix's avatar

@dagfooyo You'd have better luck starting a new thread since this one is marked as "solved" (and over a year old). A lot of people don't look in solved threads unless they are looking for an answer to the same problem they are having.

Please or to participate in this conversation.