Laravel NotFoundHTTPException on local setup

303 views Asked by At

I have inherited a site built with Laravel and Cartalyst from another developer that is working correctly on the production server however on my local installation I get a NotFoundHTTPException on the homepage and no other pages work. Local setup is laptop running Ubuntu and using Apache.

Have tried searching the forums to no avail. The site works totally correctly on the production server so it feels like it must be a configuration issue on my end rather than an actual coding issue.

When one runs php artisan route:list all routes are listed. Have also tried clearing the routing cache.

Any help or advice would really be appreciated. Relevant bits of files below.

.env file (relevant portion)


    APP_KEY=xxxxxxxxxxxx
    APP_ENV=local
    APP_DEBUG=true
    APP_LOG_LEVEL=debug
    APP_URL=https://local.voicemag.uk

.htaccess


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

Apache configuration


    <VirtualHost *:443> ServerName local.voicemag.uk
    ServerAlias local.voicemag.uk

    ServerAdmin webmaster@localhost
    DocumentRoot /home/chris/Documents/Webdev/fresh/voicemagv3/public_html

    SSLEngine on
    SSLCertificateFile "/home/chris/Documents/Webdev/ssl/server.crt"
    SSLCertificateKeyFile "/home/chris/Documents/Webdev/ssl/server.key"

    <Directory /home/chris/Documents/Webdev/fresh/voicemagv3/public_html>
      Require all granted
      Allowoverride All
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    </VirtualHost>

Let me know if you need anything further.

2

There are 2 answers

0
Chris On BEST ANSWER

The solution was to run php artisan extension:autoload

Many thanks everyone for their help

1
Manish Gupta On

NotFOundHttpException just comes because your web not find any route related to that name try to either access it by making virtual host or by

php artisan serve 

which host your site on http://localhost:8000