Sunday, March 19, 2017

Laravel 5.3 Route NotFoundHttpException

I have deployed my Laravel 5.3 application on an AWS server running Ubuntu and php 7. i have created an alias in the /etc/apache2/sites-available/000-default.conf file as below:

Alias /myapp.dev /var/www/html/myapp/public/
    <Directory "/var/www/html/myapp/public/">
            Options Indexes MultiViews FollowSymLinks
            AllowOverride All
            Order allow,deny
            allow from all
            RewriteEngine On
            RewriteBase /var/www/html/myapp/public/
    </Directory>

But when i try to access with the alias as 52.xxx.xxx.xx/myapp.dev i get the following error: enter image description here

How ever when i access it with full url to the public/ directory it works fine eg. 52.xxx.xxx.xx/myapp.dev/public/login

I have enabled a2enmod and my .htaccess file in /public directory is as below

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

any ideas as to why i am getting the Route NotFoundHttpException in my aws server and not to forget to mention that in my local windows machine running php 5.6 also is running fine with a vhost. Your ideas are very much appreciated. Thanks in advance



via Chamindar2002

Advertisement