How to make the dynamic search engine dynamic codeigniter


Question: how to make codeigniter dynamic url search engine friendly?

Example: 1

My Current URL: After selecting menu called "Articles"


Expected URL:


Example:2 My Current URL: After selecting sub-menu called "thehindu" under menu "articles"


Expected URL:


NOTE: This is dynamic URL and contents are fetching from database

What you are talking about is called as slug.

So, how to use slug?

Will explain with an example:

1) Assuming you are having a product page and ofcourse product page needs some data from URL to understand which product to display.
2) Before we were querying our database using the id we are getting from the URL. But now we'll do the same thing (querying our database) just replacing id with slug and thats it!
3) Hence adding an additional column in your database named slug. Below will be your updated product database structure (just an example).

Columns                       Values

id (int(11), PK)              1
title (varchar(1000))         Apple iPhone 5S 16GB
slug (varchar(1000))          apple-iphone-5S-16GB-brand-new
price (varchar(15))           48000
thumbnail (varchar(255))      apple-iphone-5S-16GB-brand-new.jpg
description (text)            blah blah

I've also answered on slug before. Check if it helps.
How to remove params from url codeigniter
Codeigniter - SEO Friendly URL Structure (Slug Implementation)