How To Implement Slug Replacing Id's In The URL
Presently I have a home page (index.php) which contains several links to an another page (story.php).In order to load different stories my hyper links are as follows
<a href=”story.php?cat_id=0&n_id=2”>Best Mobile Phones of 2016</a>
As you can see that the URL is like :
I want to change the URL into a Slug like
Best-Mobile-Phones-of-2016.The slugs are present as a field in a table.
Now my question is if I want to serve pages using slugs and not by id’s, then how should I go about?I mean to say that how should be my hyperlinks to different stories in the index.php.
I hope that you understand my question. Any help in this regard would be highly appreciable.
SEO friendly links basically look like this:
story/Best-Mobile-Phones-of-2016 instead of
Now when a user surfs that site, your .htaccess rewrites that url to e.g.
story.php?storyID=Best-Mobile-Phones-of-2016. Your algorithm has to figure out which
n_id is associated with the
You can also append the
n_id to your
story.php?storyID=Best-Mobile-Phones-of-2016_0_2. Then your algorithm can easily explode your
Hope that helped you.
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?