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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:28:30+00:00 2026-05-24T18:28:30+00:00

I have a controller I am using for redirects called redirect.php . This controller

  • 0

I have a controller I am using for redirects called redirect.php. This controller has a single _remap($method).

This _remap method works by attributing any URI string after the redirect controller back into the controller. For example, a request to http://mysite.com/redirect/sometext would send the request back to http://mysite.com/redirect

This is the behavior I want, but how I would make this happen at the index level so instead of having to type http://mysite.com/redirect/sometext , I could type http://mysite.com/sometext and get the same behavior. This is challenging because Index.php is used by CodeIgniter so I can’t put the _remap method here. As, I’m not super familiar with routes and .htaccess any help would be appreciated to get this working.

  • 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-24T18:28:31+00:00Added an answer on May 24, 2026 at 6:28 pm

    If you wanted to go the routes way, you would make a route for each controller you have, aka controller somepage would have a route $route["somepage"] = "somepage";, then after all of them (at the very bottom of the routes). Routes work by finding the first matching regex and then using it, so to make sure all of your controllers work, and only catch regular text, you need each of these rules.
    Then we make the ‘default’ rule, this would run for everything that didn’t get caught in a previous route check. Something like $route["(.*)"] = 'redirect/index/$1';. This would redirect you to the controller redirect, with the first uri segment (segment 3) being the sometext in your example above. Do note that this will also run for 404 pages, it would run for everything that isn’t defined in the above rules.

    I don’t see a point in this, if I were you I would just send it to the redirect controller, it would make things a bit less messy, but there is of course a way as shown above.

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

Sidebar

Related Questions

I've done tons of redirects using PHP's header function. This one has stumped me.
I have this function on my controller (Im using CodeIgniter) that reads the database,
I am using the Zend Framework. I have a controller named 'UserController' that has
I have an iPhone app using a UINavigationController. On the fourth controller of the
I have an winforms application that was built using MVC. The controller is subscribing
Using Rails v2.1, lets say you have an action for a controller that is
I have an ASP.NET MVC application using Authorization Attributes on Controllers and Actions. This
So I've got a Users controller, and it has (amongst others) a function called
I have parent view that also renders sub-controller action using RenderAction() (that returns a
When you call RedirectToAction within a controller, it automatically redirects using an HTTP GET.

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.