2

For few days i've been searching how to resolve this issue, but nothing helped.

I have laravel project c:/wamp/www/laravel/public and only the default route is working(anything i put in it it will work), but any other route is not.

These two routes i have at the moment. First one works, second one not.

Route::get('/', function () {
    return view('page.home');
});

Route::get('/shows', function () {
    return view('page.shows');
});

I tried many things in .htaccess, httpd.conf, httpd-vhosts.conf that i found on the internet but nothing works.

I've enabled rewrite_module in httpd, i've tried adding virtual host to ti or httpd-vhosts:

<VirtualHost *:80>
DocumentRoot "c:/wamp/www/laravel/public"
ServerName autoplay.dev
<Directory "c:/wamp/www/laravel/public">
        Options FollowSymLinks Indexes Multiviews
        AllowOverride All
        Order deny,allow
        Allow from 127.0.0.1
        Deny from all
        Require all granted 
</Directory>

This is my .htaccess file:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    Options +FollowSymLinks
    RewriteEngine on

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . index.php [L]

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

In it i tried RewriteBase as well but it didn't help.

Now when i try to go to any other page except home page(it's the same if i have a route or not) i get error NOT FOUND: The requested URL /wamp/www/laravel/public/index.php was not found on this server.

Please don't ask if views are in page folder and similar questions, that is correct because it's working if i switch it in default route.

Can you please help me because i've been searcing and trying for few days and this is bad for my health :D

Thanks :)

Dule
  • 19
  • 3

1 Answers1

2

In your virtual host file,

<VirtualHost *:80>
DocumentRoot c:/wamp/www/laravel/public
ServerName autoplay.dev
</VirtualHost>

Use below code in your .htaccess file:-

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

Now check autoplay.dev/ in your browser.

Link:- https://laravel.com/docs/5.0/installation#pretty-urls

Check this link also.

Hope it will help you :)

Community
  • 1
  • 1
Ravi Hirani
  • 6,511
  • 1
  • 27
  • 42
  • i've just changed . for ^ in RewriteRule, because else i already have, and it's still the same... – Dule Mar 09 '16 at 12:14
  • I've also added RewriteBase and updated 'url', and something changed. Now i'm receiving ERROR 500 - Internal Server Error. I've checked laravel logs and there's nothing. – Dule Mar 09 '16 at 12:22