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 8564833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:17:14+00:00 2026-06-11T17:17:14+00:00

I am trying to setup routing based on the 1st URI segment. I have

  • 0

I am trying to setup routing based on the 1st URI segment.

I have a rule:

$route['(:any)'] = pages/view_page/$1;

I want to make my routes conditional so that if a controller of the name of URI segment 1 is called it goes to the controller as normal.
If no controller exists then go to the pages/view_page function.

I have tried wrapping the $route rule with an if statement that checks URI segment 1 and uses that to see if a file exists to match it but this doesn’t seem to work.

Does anybody have any suggestions for how to do this without having to write lots of route configurations.

  • 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-06-11T17:17:15+00:00Added an answer on June 11, 2026 at 5:17 pm

    Since the routing overrides are simple regexp based transformations, you can’t really embed “is that would work otherwise” kind of logic directly. This leaves you with basically two options:

    1. List the routes you want to be working explicitly before the “catch all” (:any) rule
    2. Use the $route['404_override'] reserved route instead to indicate what controller should be loaded when no controller found otherwise. However, check the urls comming in and call show_404() and output proper 404 http status code for missing static assets and such.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to route a URL using codeigniter URL routing. I want to
Trying to setup a CodeIgniter based project for local development (LAMP stack), and once
I have been trying to setup git for our web development team unsuccessfully. Some
I'm trying to setup the validval plugin (latest 4.0.0) version and have no luck
I'm trying to setup a routing system for my rails app that allows for
I'm having some issues trying to setup my Routing in MVC. I think I
I am trying to work out the code igniter routing I have a url
I'm trying to get the hang of basic Rails routing. I have a model
I'm trying to route a path like this: http://www.wikipediamaze.com/wiki/Washington,_D.C. The routing framework is not
I'm using Django and Celery and I'm trying to setup routing to multiple queues.

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.