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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:11:44+00:00 2026-06-06T23:11:44+00:00

I am using CodeIgniter 2.1.1 and building a website using two environments- Production and

  • 0

I am using CodeIgniter 2.1.1 and building a website using two environments- Production and Testing. Essentially, in the beginning, both the environments have the same program logic. But now there are several modifications to be made.

The idea is to share the controllers and models of production environment and test environment but have different views for both environment.

I have set up WAMP and in the WWW directory there are two separate folders: one for testing, another one for production. There are controllers , models ,views etc under each folder. CI is pointed appropriately and the base URLs are set.

My question is even, when I type the URL in the web browser to invoke controller of test environment, it should redirect and invoke the controller of production environment. Is that possible ?

  • 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-06T23:11:47+00:00Added an answer on June 6, 2026 at 11:11 pm

    Don’t have it redirect. Have it include the file instead.

    Assuming you have this file structure:

    www-root
     |-production
     |   |-application
     |   |   |-controllers
     |   |   |-etc.
     |   |-etc.
     |
     |-test
     |   |-application
     |   |   |-controllers
     |   |   |-etc.
     |   |-etc.
     |
    

    Create files with exactly the same name in both environments. We’ll say controller.php for our example. In the production environment, do your coding. In your test environment, include this line and only this line:

    <?php include '../../../production/application/controllers/controller.php';
    

    This should pull the file from your production environment into your test environment. Just ensure if your hard-coding any links to make them relative as opposed to absolute. This way when it gets pulled into you test environment, it’ll make reference to your testing assets and not your production ones.

    This is untested as I don’t have access to my CI installation right now. Let me know how it turns out.

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

Sidebar

Related Questions

This is my first time building a website and using CodeIgniter for a school
I'm building my first CodeIgniter app - and have a registration form. I'm using
I'm building a site using CodeIgniter and up until now things have been going
I am building a multi-language site using codeigniter I have this language file $lang['prot_home_1']
I'm building a site using CodeIgniter. I have lots of experience using SQL with
I am using CodeIgniter and I have two different controllers - login.php and site.php
I am building a webapp using Codeigniter (PHP) and MongoDB. I am creating indexes
I'm building a site using CodeIgniter that largely consists of static content (although there
I am building a web app using Codeigniter 2.0.3. I need to create base
I have been using CodeIgniter all these while, and have solid foundation in OOP

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.