0

I am using laravel 5.2 and I have search form which pass GET parameter, so in url its like

http://www.example.com/list/item?&qs=&unit-type=Office&min-bed=&max-bed=&min-price=&max-price=

so search result is shown with such ugly url, I want to make this url seo friendly, I don't want to use post method.

Is there any .htaccess code that can help to make seo friendly url of such get parameter.

I tried this .htaccess code but doesn't work.

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?params=$1 [L,QSA]
Jay
  • 821
  • 2
  • 18
  • 50
  • I think [this question](http://stackoverflow.com/questions/31681750/how-to-use-laravel-routing-for-unknown-number-of-parameters-in-url) will help you with your problem. – Laurent Meganck Oct 26 '16 at 15:05
  • What do you mean by SEO friendly? It is not clear if you are looking to use `/` instead of `&` or if you want a way to use parameters with forward slashes. – Wistar Oct 26 '16 at 15:07
  • I want to use parameters with forward slashes – Jay Oct 26 '16 at 15:15

1 Answers1

2

What you are doing is possible, but shouldn't be done.

The page is not a static page, or a product page, or a listing page. It is a search result page.

The search result page should not be SEO friendly in terms of the url containing information about the search query because this is supposed to be dynamic. A search engine will not be interested in indexing a specific user's search result page on your website. A search engine will be interested in indexing the search page.

If you are looking to have a product listing page for example with pre-defined search queries, then why not just create a specific controller and for the time being, manually write an SEO friendly url to point to the required method on that controller?

e.g.

Route::get('offices-between-10000-and-20000-pounds', 'ListingController@getOfficesBetweenPriceRange');

Gravy
  • 12,264
  • 26
  • 124
  • 193