如何使用给定的URL访问控制器方法

I am using laravel framework. I need to access controller method with the name of the given url. My routes code look like below :

   <?php
      Route::get('home','HomeController@showWelcome');
   ?>

HomeController.php look like this

   <?php

     class HomeController extends BaseController {
        public function showWelcome()
       {
          return View::make('hello');
       }
     }

   ?>

My problem is can't able to access the method of showWelcome while giving the url like http://example.com/home

But i can able to access with the url http://example.com/index.php/home

How to sove this issue.. can anyone help me to do this..Thanks in advance.

.htaccess file look like below :

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

This should be a comment,but I don't have enough reputation now.

This is a rewrite problem,have a look at http://laravel.com/docs/4.2/installation#pretty-urls to check out you have right configuration.

If you are using apache and your .htaccess doesn't work,it's because the mod_rewrite is turned off.

Hope this helps.

At first you should turned on mod_rewrite.

If it does not work, then edit public/.htaccess and try this one:

Options +FollowSymLinks
RewriteEngine On

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