opencart seo url rewriting

0 votes

The one i am having trouble with relates to a blog that I've set up. The table for the blog entries has an SEO keyword column for each respective entry. The current URL comes up as imbued.co.uk/blog?news_id=5 with 5 being the 5th blog entry. I would rather the URL was cleaner such as imbued.co.uk/blog/seokeywordfromthetable

Can the SEO URL file below be tweaked for it to come as such?

<?php
class ControllerCommonSeoUrl extends Controller {
        /* SEO Custom URL */
        private $url_list = array (
            'common/home'            => '',
            'checkout/cart'          => 'basket',
            'product/special'        => 'special',
            'product/search'         => 'search',
            'affiliate/account'      => 'affiliate',
            'account/voucher'        => 'gift-voucher',
            'checkout/success'       => 'checkout/success',
            'product/manufacturer'   => 'brand',
            'account/transaction'    => 'transactions',
            'information/contact'    => 'contact-us',
            'product/compare'        => 'compare',
            'information/news'       => 'blog',
            'information/sitemap'    => 'sitemap',
            );
        /* SEO Custom URL */

    public function index() {
        // Add rewrite to url class
        if ($this->config->get('config_seo_url')) {
            $this->url->addRewrite($this);
        }

        // Decode URL
        if (isset($this->request->get['_route_'])) {
            $parts = explode('/', $this->request->get['_route_']);

            foreach ($parts as $part) {
                $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE keyword = '" . $this->db->escape($part) . "'");

                if ($query->num_rows) {
Feb 19, 2022 in Others by Kichu
• 19,040 points
898 views

1 answer to this question.

0 votes
first of all to do this you need to add seo keywords to url_alias and before that in the admin too. In place use  blog_id=XXX thats also an important step after  that try handling the seo urls in common/seo_url.php
answered Feb 20, 2022 by narikkadan
• 63,600 points

Related Questions In Others

0 votes
1 answer

PHP Convert String to SEO Friendly Url For Bengali Language Type

$string = preg_replace("/[^a-z0-9]/u", "$separator", $string);  change the ...READ MORE

answered Feb 14, 2022 in Others by narikkadan
• 63,600 points
1,148 views
0 votes
1 answer

nginx clean url with seo friendly file names

server {     listen 80;     server_name example.com;     root   /full/server/path/to/your/cms;     index  index.php;     location / ...READ MORE

answered Feb 14, 2022 in Others by narikkadan
• 63,600 points
991 views
0 votes
1 answer

Generator URL Friendly SEO PHP with .htaccess

Options +FollowSymLinks -MultiViews RewriteEngine on RewriteBase / # skip all ...READ MORE

answered Feb 14, 2022 in Others by narikkadan
• 63,600 points
4,471 views
0 votes
1 answer

Legitimate URL Cloaking for SEO?

the redirection technique your planning to implement ...READ MORE

answered Feb 15, 2022 in Others by narikkadan
• 63,600 points
479 views
0 votes
0 answers

Replace tags with space in PHP for SEO Meta Description

I am trying to strip tags from ...READ MORE

Mar 12, 2022 in Digital Marketing by Kichu
• 19,040 points
609 views
0 votes
0 answers

Replace tags with space in PHP for SEO Meta Description

I am trying to strip tags from ...READ MORE

Mar 13, 2022 in Digital Marketing by Kichu
• 19,040 points
664 views
0 votes
2 answers

Define a SQL query? What is the difference between SELECT and UPDATE Query? How do you use SQL in SAS?

HI.. SQL is Structured Query Language, which is ...READ MORE

answered Aug 8, 2020 in PHP by anonymous
10,602 views
0 votes
1 answer

Why is not preferable to use mysql_* functions in PHP?

The reasons are as follows: The MySQL extension: Does ...READ MORE

answered Sep 7, 2018 in Database by DataKing99
• 8,250 points
1,285 views
0 votes
1 answer

Opencart 3 .x SEO Url not working for route=information/contact, route=account/login

now i m going to see you ...READ MORE

answered Feb 20, 2022 in Others by narikkadan
• 63,600 points
2,897 views
0 votes
1 answer

Writing SEO friendly url gets infinite loop asp.net

you should know that regex avoid cases ...READ MORE

answered Feb 11, 2022 in Others by narikkadan
• 63,600 points
816 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP