1

Site built on OpenCart 3.0.2.0

Problem: when doing a search, all links in the search results page have "?search={search_string}&description=true" added to them.

I.e. if I do a search for "big red widget", all of the items on the list of search results have URLs that look like this:

https://example.com/big-red-widget-001?search=big%20red%20widget&description=true"

Option 1: remove this behavior by modifying the OpenCart file/s. Anyone have advice on what to modify & where?

Option 2: delete the extra parameters via .htaccess. Yes, I've found some solutions on removing parameters - such as Remove parameter from URL viac .htaccess.

Problem is, it breaks the search function completely - because the search results page itself uses these parameters:

https://example.com/index.php?route=product/search&search=big%20red%20widget&description=true

So if this solution is implemented, the search results page comes up empty even on valid searches.

Unless there's a way to say "remove these parameters except on this particular page" (search results page)?

TomJones999
  • 775
  • 2
  • 13
  • 30
  • That's hardly useful. URL parameters came to be for search queries specifically. Have you seen Google itself avoiding them? Would you want Googlebot to cache and recurringly hammer database searches on your site? – mario Nov 28 '17 at 21:36
  • Google doesn't go into my site & do a manual text search for each item. It traverses the pages & reads the links. So where would the "recurring" part come from? The links to the actual items would still be there, on the category pages. I'm talking about the search results page specifically. The issue is that when a *human* user does a search, all of the links on the search results have the search query appended to them - it doesn't look good (as far as aesthetics). I'd like to remove it, but I don't know how. – TomJones999 Nov 30 '17 at 17:53
  • In other words - what I'm getting is "https://example.com/big-red-widget-001?search=big%20red%20widget&description=true" - what I want is "https://example.com/big-red-widget-001" – TomJones999 Nov 30 '17 at 17:54
  • I have exactly the same question,have you got the useful solution? – bestshop24h Dec 27 '20 at 10:06

1 Answers1

0

Yes, use RewriteCond: https://stackoverflow.com/a/14008032/3650835

To exclude a file, try something like this:

RewriteCond %{REQUEST_URI} !^/pureplantessentials\.html$

The rule will be skipped if the file is pureplantessentials.html

Official docs: http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritecond

KayakinKoder
  • 3,243
  • 3
  • 23
  • 37