Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3284260
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:08:05+00:00 2026-05-17T20:08:05+00:00

I would like to create a custom CMS within Codeigniter, and I need a

  • 0

I would like to create a custom CMS within Codeigniter, and I need a mechanism to route general pages to a default controller – for instance:

mydomain.com/about
mydomain.com/services/maintenance

These would be routed through my pagehandler controller. The default routing behaviour in Codeigniter is of course to route to a matching controller and method, so with the above examples it would require an About controller and a Services controller. This is obviously not a practical or even sensible approach.

I’ve seen the following solution to place in routes.php:

$route['^(?!admin|products).*'] = "pagehandler/$0";

But this poses it’s own problems I believe. For example, it simply looks for “products” in the request uri and if found routes to the Products controller – but what if we have services/products as a CMS page? Does this not then get routed to the products controller?

Is there a perfect approach to this? I don’t wish to have a routing where all CMS content is prefixed with the controller name, but I also need to be able to generically override the routing for other controllers.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T20:08:05+00:00Added an answer on May 17, 2026 at 8:08 pm

    If you use CodeIgniter 2.0 (which has been stable enough to use for months) then you can use:

    $route['404_override'] = 'pages';
    

    This will send anything that isn’t a controller, method or valid route to your pages controller. Then you can use whatever PHP you like to either show the page or show a much nicer 404 page.

    Read me guide explaining how you upgrade to CodeIgniter 2.0. Also, you might be interested in using an existing CMS such as PyroCMS which is now nearing the final v1.0 and has a massive following.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to create custom slugs for pages in my CMS, so users
I would like to create a custom control in order to display a pie
I would like to create a custom document library where I use the standard
I would like to create a custom control in my Android App. It will
I would like to create a custom data type which basically behaves like an
I have authored some custom classes that I would like to create using XAML:
I would like create a custom DataRow that will have -let's say- a propery
I would like to create a custom UITableViewCell with 3 fields. I would like
I would like to create a custom NSView that takes a layered approach to
I would like to create some custom UI controls that work with both WPF

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.