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

juu073's avatar

Moved app, now getting 404 Not Found error

Hi all,

I moved a Laravel app I've been working on and I get a 404 error.

I transferred all of the files and ran composer install to grab the vendor directory without issue.

The initial route that shows the "Welcome" screen (with the four boxes for Documentation, Laracasts, Laravel News, and Ecosystem) works fine, but clicking Login and Register in the top Right both produce "not found" errors. I've verified laravel/breeze that I used is installed.

In addition, I tried domain.name/dashboard, and it also gives a 404 error -- although I guess theoretically it could be looking for the same login route above.

Any ideas?

EDIT 1: Another helpful tidbit -- originally I was getting a Laravel error message when I did not have one of the php modules needed installed on the server. I've checked and the correct .htaccess file is in the root directory. But I'm wondering if it correctly picked up on the correct welcome only because it happened to match / and something else is going on.

EDIT 2: Nevermind, all. Figured it out. I didn't enable .htaccess in my site.conf file in /etc/apache2/sites-available/.

0 likes
1 reply
LaryAI's avatar
Level 58

It sounds like the issue you're experiencing could be related to the web server configuration or the Laravel application's route cache. Here are a few steps you can take to troubleshoot and resolve the 404 Not Found error:

  1. Check your web server configuration: Ensure that your web server (Apache/Nginx) is configured to point to the public directory of your Laravel application and that the server is configured to handle URL rewriting correctly.

    • For Apache, you should have a .htaccess file in your public directory with the following content:

      <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]
      
          # Handle Front Controller...
          RewriteCond %{REQUEST_FILENAME} !-d
          RewriteCond %{REQUEST_FILENAME} !-f
          RewriteRule ^ index.php [L]
      </IfModule>
      
    • For Nginx, you should have a configuration block similar to this:

      location / {
          try_files $uri $uri/ /index.php?$query_string;
      }
      
  2. Clear Laravel caches: Sometimes, after moving an application, cached configurations and routes can cause issues. Run the following commands to clear the application cache:

    php artisan cache:clear
    php artisan route:clear
    php artisan config:clear
    php artisan view:clear
    
  3. Check your routes: Make sure that the routes for login and registration are defined in your routes/web.php file. Laravel Breeze registers its routes within its own service provider, so they should be available if Breeze is installed correctly.

  4. Check the .env file: Ensure that the APP_URL in your .env file matches the new domain name or address you are using for your application.

  5. Permissions: Ensure that the storage and bootstrap/cache directories are writable by the web server. You can set the correct permissions using:

    chmod -R 775 storage bootstrap/cache
    chown -R www-data:www-data storage bootstrap/cache
    

    Replace www-data:www-data with the appropriate user and group for your web server.

  6. Regenerate key: If you haven't done so already, you might need to regenerate your application key. You can do this with:

    php artisan key:generate
    
  7. Check for errors in the logs: Look at the Laravel log file in storage/logs/laravel.log for any errors that might give you more information about the issue.

After going through these steps, try accessing the application again. If you're still facing issues, you may need to provide more information about your web server configuration and any error messages you're seeing in the logs.

Please or to participate in this conversation.