Trying to find SEO friendly URL for the search page. I tried the following code in .htaccess file.
RewriteRule ^search/([^/]*)$ index.php?route=product/search&search=%{QUERY_STRING} [L]
And
catalog/controller/startup/seo_url.php:
} elseif ($data['route'] == 'product/search' && $key == 'tag') {
$url .= '/tags/' . str_replace(' ','-',$value);
unset($data[$key]);
} elseif ($data['route'] == 'product/search' && $key !== 'tag') {
$url .= '/search/' . str_replace(' ','-',$value);
unset($data[$key]);
//....
Is there any way to rewrite routes without choosing one or the other?
Using Opencart 2.3.0
If you don't want not use any extension, which adds a custom SEO URL functionality, you can try to insert query/keyword pair into url_alias table.
Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com
That doesn't work, unfortunately. The built-in SEO system for OpenCart only affects product, category, manufacturer, and information pages. You can't rewrite other URLs just by inserting the data into the "url_alias" table, though hopefully that will be possible in a future version. (Especially given how common this type of question is.)
I know very well, how it works, I have my own SEO extension. Since the guy already managed to find out, where to edit the script, I gave him a tip about database. Hopefully, it will be enough for him.Johnathan wrote: ↑Tue Jul 17, 2018 11:12 pmThat doesn't work, unfortunately. The built-in SEO system for OpenCart only affects product, category, manufacturer, and information pages. You can't rewrite other URLs just by inserting the data into the "url_alias" table, though hopefully that will be possible in a future version. (Especially given how common this type of question is.)
Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com
If I can add keyword directly to table then we compulsory need to coding in seo_url.php file. Without adding this file SEO URL is not working.
Who is online
Users browsing this forum: No registered users and 75 guests