can anyone tell me how to do seo friendly url in laravel 3

507 Views Asked by At

i am using laravel 3 for my web application, i know how to route and all that stuff,it is seo friendly but i want to fetch data from textbox and include that in URL.

i want to include "java-complete-referance "` from textbox to URL.

like in search bar user enters for java complete rerence and i want to pass that data to route and url should be like myweb.com/catagory/books/java-complete-referance.

laravel form having get and post option but how to pass that form data to route's get or post method and display that textbox value in url

thanx in advance.

1

There are 1 best solutions below

4
On

your Route:

Route::get('category/(:any)/(:any)', array( 'uses' => 'Articles@show'));

now in your route get the category id by the name, and get the article id by the title(ofcourse you need to make sure that the title is uniqe when creating)

if you want to make search is the same.. get the category id by the name and get the search string from title (make some function to replace '-' by space)

public function Show($category_id,$article_title){

}