Post by dswtpl » Tue Jul 17, 2018 6:57 pm

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

New member

Posts

Joined
Thu Feb 12, 2015 10:17 pm

Post by thekrotek » Tue Jul 17, 2018 10:23 pm

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


User avatar
Expert Member

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by Johnathan » Tue Jul 17, 2018 11:12 pm

thekrotek wrote:
Tue Jul 17, 2018 10:23 pm
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.
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.)

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by thekrotek » Wed Jul 18, 2018 12:05 am

Johnathan wrote:
Tue Jul 17, 2018 11:12 pm
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.

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by dswtpl » Wed Jul 18, 2018 6:23 pm

thekrotek wrote:
Tue Jul 17, 2018 10:23 pm
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.
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.

New member

Posts

Joined
Thu Feb 12, 2015 10:17 pm
Who is online

Users browsing this forum: No registered users and 169 guests