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 http://www.imbued.co.uk/blog?news_id=5 with 5 being the 5th blog entry. I would rather the URL was cleaner such as http://www.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 in Others by Kichu
• 19,040 points
70 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 by narikkadan
• 10,840 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 in Others by narikkadan
• 10,840 points
76 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 in Others by narikkadan
• 10,840 points
59 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 in Others by narikkadan
• 10,840 points
629 views
0 votes
1 answer

Legitimate URL Cloaking for SEO?

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

answered Feb 15 in Others by narikkadan
• 10,840 points
51 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 in Digital Marketing by Kichu
• 19,040 points
20 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 in Digital Marketing by Kichu
• 19,040 points
59 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
4,510 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,240 points
340 views
0 votes
1 answer
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 in Others by narikkadan
• 10,840 points
146 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP