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

  • Home
  • SEARCH
  • 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 8098779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:10:59+00:00 2026-06-05T22:10:59+00:00

Is there any point in the execution of CodeIgniter where I can get data

  • 0

Is there any point in the execution of CodeIgniter where I can get data from MySQL through HTTP_HOST and use and set the base_url retrieved so that the correct routing is enforced?

I didn’t have any problem with running this under the hook event post_controller_constructor when I only used sub.domain.com and domain.com, but I this problem when I wish to have base_url as domain.com/folder/.

My Codeigniter has already decided which controller to load, and changing the base_url doesn’t fix it.

From my knowledge, I can’t do MySQL commands before the hook event post_controller_constructor, which I guess I must be able to do since base_url should be set before routing occurs.

So basicly, is there any efficient way to either reroute in middle of the execution, or to run mysql before routing occurs?

CodeIgniter Hooks

Update
Seems like I was on the wrong track.

Here’s the scenario:

I have one CodeIgniter package/set. At the moment I use it through multiple domains and subdomains. My CodeIgniter loads relevant profile based on HTTP_HOST. I’ve made it to also load relevant profile in case it contains a folder to the domain. The problem is that the routing occurs and see’s the folder as a part of the controller/routing instead of the base_url.

With the address http://domain.com/folder/admin I want the controller admin loaded (inside controllers/), not the controller folder.

In some way I want to draw the conclusion that the entire part of the base_url will be excluded in the routing process.

It’d be similiar to $route['\w+/(.+)'] = '$1'; but based on MySQL.

  • 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-05T22:11:01+00:00Added an answer on June 5, 2026 at 10:11 pm

    base_url has nothing to do with routing, only URLs.

    You can use a pre_controller hook, post_controller_constructor hook, or run it in a base controller __construct (such as MY_Controller).

    It’s this easy:

    // Fetch base_url from database...
    $this->config->set_item('base_url', $new_base_url);
    

    Functions like base_url() read from the CI $config array, so you can change it at any time.

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

Sidebar

Related Questions

Is there any one who can point me to a Rails 3.2 multilingual starter
Is there any way to get the local end point of a connected Silverlight
Is there any comparison to show why JSP/ASP.Net is better from security point of
Is there any way to set up Visual Studio (just upgraded from 2008 to
Would there be any point in adding resx files to a distributed cache? What
Is there any way to rotate a disclosure button? I'd like it to point
Is there any way I can print/show images on top of each other. The
Is there any way to stop the execution EVERY time the app enter in
In a replacement pattern, is there any way to print the NUMBER of the
Is there any alternatives to the print statement for output in Python. Also, how

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.