4

I have a question I've been struggling quite a while with it. I have a basic search engine on my website, where you can search for 4 categories (checkboxes) + a price. Instead of posting to strange url's like /q?categories[]=a&categories[]=b&price=2000-3000, I'd like them to be like:

/search/category-a
/search/category-b
/search/category-a/2000-3000/

etc.

The question is now: the user is able to search for category a OR category b. What's the best way to handle this:

/search/category-a,category-b/...
/search/category-a.category-b/...
/search/category-a|category-b/...
/search/category-a/category-b/...

What do you SEO experts suggest? I've red about the the difference between underscores and dashes in google, but I can't find anything about this multi-category issue.

1

I would consider separating the parameter and value by directories and using dashes. e.g.

/search/category/a-b-c/price/2000-3000/

I'd say the URL structure is a smaller concern than the duplication issues which may arise. Ensure you have canonical tags for handling:

/search/category/a-b-c/price/2000-3000/
/search/category/a-b-c/price/3000-2000/
/search/category/b-a-c/price/2000-3000/

Which will all show the same results.

I would also advise noindexing pages which have no results otherwise Googlebot can (and likely will) spam your server with search requests and use up your bandwidth.

  • Interesting, and if the categories themselves consist of multiple words? Like for-sale and for-rent, would you then just add them all after each other separated with dashes? – Nicolas Jun 29 '15 at 14:48
  • 1
    Ah, interesting question, if you go after what [link]Matt Cutts said in 2011(youtube.com/watch?v=AQcSFsQyct8), he says they split words with hyphens and join them with underscores. e.g. /hello-seo-world would be index "hello", "seo", "world" /hello_seo_world would index the phrase "hello seo world". I don't know how much impact it would have now in 2015, but a solution may be: /search/category/for_sale-for_rent/ I don't have any direct experience with results with that URL structure but I doubt it will hinder you. – Shree Jun 29 '15 at 19:34
2

Did a little research on this, it seems using + is a common practice when it comes to multi category URL. Some webmasters who have used this method recommend it.

Example: /search/(category-a)+(category-b)/...

  • Thanks, you mean without brackets? So google can index my keywords as "category a" or with brackets? Which sites are doing it like this? Thanks a lot! – Nicolas Jun 29 '15 at 13:12
  • @Nicolas Google is using this approach. google.com/… . Brackets were to indicate that the category-a must be a single term. You will of course use it without bracket. – Preston Pierce Jun 30 '15 at 7:38
1

Having "pretty permalinks" show up with search is one thing, having the countless search results pages fed to google is another - it's better to even noindex them.

  • Thanks, but I want them also to be indexable, like /search/category-a, since it's a very limited combination of categories, and the categories themselves also describe the content. Parameters like sorting etc I'd pass them as a query-string and them noindex. – Nicolas Jun 29 '15 at 13:11
  • I see, then the search doesn't necessarily have to be there for those pages, but nor does it harm in anyway. For the structure I'd go with version 4 - all slashes - it's the safest way to avoid unexpected complications later. – Lucian Davidescu Jun 29 '15 at 13:32
0

Before establishing a URL format, you want to take a look at your back-end to see that it can actually handle the format. If your server is apache, you'll likely be using rewrite rules with the mod_rewrite module. Also, you will have to feed the format into a dynamic script. Let me explain.

Say you are using the query of four items named item1, item2, item3 and item4, and you have a price range from 0 to 500.

Say we have this URL format in mind: http://example.com/query/item1,item2,item3,item4:0-500

Then the .htaccess file will contain lines like this to efficiently process the URL:

RewriteEngine On
RewriteRule ^/query/(.*):(.*)$ /queryengingprocessor.php?itemlist=$1&pricerange=$2

Then the PHP file /queryengingprocessor.php will have itemlist equal to a comma-separated list of items and pricerange will be a numeric range. However, the values need to be further checked in php, and luckily, the explode function can separate the values further.

If you decide to use a different URL format such as http://example.com/query/item1,item2,item3,item4,0-500 then the processing will be somewhat more difficult because the colon in the last URL example was used as the separator to divide the items from the price range.

So your decision should be based on your knowledge of processing the data in the back-end scripts. I apologize if it's not a 100% black-and-white concrete answer, but don't make yourself do extra work as a result for choosing the wrong URL format.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.