H.Rafiee
H.Rafiee

Reputation: 368

Laravel : HTML::linkRoute not generate SEO friendly URL

Hello My Friends.

You can See My Title of Question HTML::linkRoute not generate seo friendly url. and also link_to_route not work fine.

{{HTML::linkRoute('test',"link to Test',array(4)}}

its href return

http://localhost/lar/public/test?4

but i wanna seo friendly public/test/4
url function work fine but why generator not work for me?!

Upvotes: 0

Views: 1014

Answers (2)

Razor
Razor

Reputation: 9835

Because you probably defined your route without parameters:

Route::get('/test/{id?}',array('as'=>'test', function($id){
    var_dump($id);
}));

{{HTML::linkRoute('test',"link to Test",array(4)}}
// http://localhost/lar/public/test/4

Upvotes: 4

www.data-blogger.com
www.data-blogger.com

Reputation: 4164

The array is converted to a query-string. This is typically the part after the '?' in the URL. What you can do, is the following: {{HTML::linkRoute('test',"link to Test') . '/4/'}}

Upvotes: 1

Related Questions