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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:28:56+00:00 2026-06-16T13:28:56+00:00

Possible Duplicate: CodeIgniter – When using $route[‘(:any)’] = ‘pages/view/$1’ how to use other controllers?

  • 0

Possible Duplicate:
CodeIgniter – When using $route[‘(:any)’] = ‘pages/view/$1’ how to use other controllers?

I’m working on a url shortener/redirect web app in codeigniter and have ran into an issue with my routes.

The first route i have is:

$route['(:any)'] = "redirect/index/$1";

This is what handles the redirect, so example.com/dwB would goto the redirect controller.

Underneath I have a few routes that override that for pages and other controllers etc. They work fine when i describe the entire url including arguments etc but I have now ran into trouble as i have some dynamic urls like:

 example.com/stats/view/dwB

Or facebook auth responses etc, which i can’t obviously write a route for. I’ve tried using something like:

 $route['stats/view/(:any)'] = "stats/view/$1";

but none of these appear to override the first route. Here is my entire routes.php document.

$route['(:any)'] = "redirect/index/$1";

$route['shorten/create'] = "shorten/create"; // overwrite the previous route

$route['stats/view/(:any)'] = "stats/view/$1"; // allow the stats controller to be used

$route['login'] = "auth/login"; // allow the login(auth) controller to be used
$route['register'] = "auth/register"; // allow the login(auth) controller to be used
$route['auth_social/fblogin'] = "auth_social/fblogin"; // allow the login(auth) controller    to be used
$route['dashboard'] = "dashboard"; // allow the login(auth) controller to be used
$route['auth/logout'] = "auth/logout"; // allow the login(auth) controller to be used
$route['auth'] = "auth/index"; // allow the login(auth) controller to be used

$route['default_controller'] = "pages";

$route['404_override'] = '404';
  • 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-16T13:28:57+00:00Added an answer on June 16, 2026 at 1:28 pm

    As I mentioned in the comments, place your “any” route at the end of your custom routes, like this:

    $route['shorten/create'] = "shorten/create"; // overwrite the previous route
    
    $route['stats/view/(:any)'] = "stats/view/$1"; // allow the stats controller to be used
    
    $route['login'] = "auth/login"; // allow the login(auth) controller to be used
    $route['register'] = "auth/register"; // allow the login(auth) controller to be used
    $route['auth_social/fblogin'] = "auth_social/fblogin"; // allow the login(auth) controller    to be used
    $route['dashboard'] = "dashboard"; // allow the login(auth) controller to be used
    $route['auth/logout'] = "auth/logout"; // allow the login(auth) controller to be used
    $route['auth'] = "auth/index"; // allow the login(auth) controller to be used
    
    // Move "any" route down here...
    $route['(:any)'] = "redirect/index/$1";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: how to remove index.php from url in codeigniter ? I want to
Possible Duplicate: Codeigniter HVMC modular seperation extension URL rewrite / routing I am new
Possible Duplicate: codeigniter : pass data to a view included in a view How
Possible Duplicate: url encoded forward slashes breaking my codeigniter app This is my controller:
Possible Duplicate: CodeIgniter and the Model-View-Controller – your experience / your meaning? I am
Possible Duplicate: .htaccess throws a 500 error I am using CodeIgniter and need to
Possible Duplicate: Problem with database in CodeIgniter Alright, I've googled this the last two
Possible Duplicate: PHP get both array value and array key I am using Codeigniters'
Possible Duplicate: How do I make a request using HTTP basic authentication with PHP
Possible Duplicate: Objective C for Windows iPhone development on Windows Is there any way

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.