1

Hello I'm new here and I've been trying to learn Laravel but have fallenat the first hurdle. I have searched for the answer and tried several suggestions but nothing worked for me. I am running Wamp and have installed Laravel with composer. I have my routes.php file

Route::get('/', 'WelcomeController@index');
Route::get('/home', 'HomeController@home');


Route::get('about', 'pagesController@about');

Route::controllers([
    'auth' => 'Auth\AuthController',
    'password' => 'Auth\PasswordController',
]);

The welcome controller works fine it's the other two I just get a 404 not found error. Thanks for any help.

Sven
  • 69,403
  • 10
  • 107
  • 109
Paul Haskett
  • 21
  • 1
  • 5

2 Answers2

0

That's 404 error that you get is from apache. You need to call your page with http://site/index.php/home. If you want remove index.php from the url then you have to to re-write the url like this.

Community
  • 1
  • 1
Federkun
  • 36,084
  • 8
  • 78
  • 90
  • ok thanks I've tried adding to the .htaccess file (in the public folder do I need one in the project root folder) but that didn't work. I changed the server.php to index.php to get rid of the /public/ directory in the url. was that the wrong thing to do? Should I attempt method two and move all the content into root? – Paul Haskett May 30 '15 at 12:58
  • If you using wamp try to access public folder like http://site/public/index.php/home. if you add .htaccess to remove index.php from url then try to access like http://site/public/home – Mohammed Safeer May 30 '15 at 15:14
0

If you using wamp try to access public folder like http://site/public/index.php/home. If you add .htaccess to remove index.php from url then try to access like http://site/public/home

Apache

The framework ships with a public/.htaccess file that is used to allow URLs without index.php. If you use Apache to serve your Laravel application, be sure to enable the mod_rewrite module.

If the .htaccess file that ships with Laravel does not work with your Apache installation, try this one:

Options +FollowSymLinks
RewriteEngine On

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

as laravel documentation says. http://laravel.com/docs/5.0#server-requirements

Mohammed Safeer
  • 20,751
  • 8
  • 75
  • 78
  • Ok thanks, I've just realised that I can run php artisan serve in the command line, I had to change the server.php back. Is it better to develop it that way? Thanks for advice. – Paul Haskett May 30 '15 at 18:26
  • php artisan serve will run Laravel's Built-in Web Server. You can also set up another web server. – Mohammed Safeer May 31 '15 at 08:26