0

I've set my document root as follows:

c:/wamp/www/laravel/public

When I test localhost on the browser I get the "You have arrived" page.

However when I try localhost/page0, I get a 404.

In my routes.php file I have this:

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

Route::get('page0', function() {
    return 'Test Helloworld! 0';
});

My .htaccess file looks like this:

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

It looks like everything should work. Why doesn't this work?

Howard
  • 3,648
  • 13
  • 58
  • 86

2 Answers2

1

You might want to check if mod_rewrite is enabled by doing:

phpinfo();

You can issue this in your routes.php.

It is also possible to start a webserver in php like so from the terminal or command prompt depending on your OS:

php -S localhost:8080 -t public/

Do this from your project root. Then you can go to:

localhost:8080

And your site should be up and running. You can still use the MySQL server that is running from XAMPP or WAMPP.

sidneydobber
  • 2,790
  • 1
  • 23
  • 32
0

Use

c:/wamp/www/laravel/public/page0 

This should work.

For production and/or development you can set the document root to the "public" folder, to get rid of the "/public/" in your url:

@see https://stackoverflow.com/a/15469480/1854296 (for example)

Community
  • 1
  • 1
Dane
  • 408
  • 5
  • 8