ONYX
ONYX

Reputation: 5859

Laravel Virtual Host Request Url Not found

I'm having a problem with my laravel application using VirtualHosts, I can see the home page of laravel but when I try to make a route like advkit.dev/login I get "The requested URL /login was not found on this server." So all my routes aren't working does anyone know what I need to change in my code to make routes work. I also have set debug to true and I only get the debuging console on the home page e.g advkit.dev no where else

route:

<?php

Route::get('/', function()
{
    return View::make('hello');
});

// login.blade.php
Route::get('/login', function() {
    return View::make('login');
});

hosts

127.0.0.1       www.localhost.com
127.0.0.2       advkit.dev

httpd-hosts file

<VirtualHost advkit.dev>
    DocumentRoot C:\wamp\www\advkit\public
    ServerName advkit.dev
</VirtualHost>

Upvotes: 4

Views: 4658

Answers (3)

Kaushik shrimali
Kaushik shrimali

Reputation: 1228

You can add the following lines in your .conf file.

<Directory /var/www/gloops/public>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
 </Directory>

After save the files and enable rewrite mode by the given command and restart the apache2 service.

sudo a2enmod rewrite
sudo service apache2 restart

Upvotes: 3

LogicFirst
LogicFirst

Reputation: 190

I had the same problem and the virtualhost setup given in the following answer worked for me: https://stackoverflow.com/a/33760330/4561150

<Directory "C:/myproject/mysubfolder/public">
   Options Indexes FollowSymLinks Includes ExecCGI
   AllowOverride All
   Require all granted
</Directory>

Upvotes: 2

BrokenBinary
BrokenBinary

Reputation: 7879

It sounds like Apache is ignoring your .htaccess file. You could fix that, but the better solution is to put the contents of that .htaccess file in your virtualhost. Then your virtualhost would look like this:

<VirtualHost advkit.dev>
    DocumentRoot C:\wamp\www\advkit\public
    ServerName advkit.dev

    <Directory C:\wamp\www\advkit\public>
        # Ignore the .htaccess file in this directory
        AllowOverride None

        # Rewrite URLs
        <IfModule mod_rewrite.c>
            <IfModule mod_negotiation.c>
                Options -MultiViews
            </IfModule>

            RewriteEngine On

            # Redirect Trailing Slashes
            RewriteRule ^(.*)/$ /$1 [L,R=301]

            # Handle Front Controller
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteRule ^ index.php [L]
        </IfModule>
    </Directory>
</VirtualHost>

Upvotes: 0

Related Questions