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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:55:00+00:00 2026-06-04T17:55:00+00:00

I am trying to build a web API with CodeIgniter as PHP framework. This

  • 0

I am trying to build a web API with CodeIgniter as PHP framework.

This is not a REST api. It is just a Web api which mean all queries will be POST queries.

A typical query will look like this

http://host/api1/user/get_name

and

http://host/api2/user/get_name

Under such circumstances api1 and api2 become controllers and user becomes a method under it.

I am not happy with this because then my api1 and api2 classes become too large and also I dont like to mix unrelated code in a single class.

What can I do ? Can I play with my .htaccess file or the routing configuration such that everytime the server receives a request of the form \^api\ it forwards it to appropriate controller ?

Please note that api1 and api2 are not the only controllers in my system.

  • 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-04T17:55:02+00:00Added an answer on June 4, 2026 at 5:55 pm

    You have to consider the couple of things

    1. Are they interdependent?
    2. You must have some specific reason for maintaining 2 web APIs.

    If they are not interdependent then i will recommend you to do this

    http://host1/user/get_name
    http://host2/user/get_name
    

    If they are interdependent then you must do

    http://host/api1/user/get_name
    http://host/api2/user/get_name
    

    Reason behind that is you do not need to maintain the 2 different models.

    For example, if you made some changes in a X_model.php, you have to upload that on both server.

    And you can create folder under controller. I am very confirm about that. I have done it in codeigniter 1.7.

    So you can create folder respectively and continue with it.!

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

Sidebar

Related Questions

I'm trying to build a 4-tier Web-Application in Java. I'm using the Hibernate Framework
When trying to deploy a new web api project which is created from the
I am trying build an automated testing framework for some of our internal web
I'm currently developing a C# MVC REST web api, and am trying to choose
I am new to PHP and web development. I am trying to build a
I'm trying to build a Web page that has a rich text editor. Is
I'm trying to build a generic web service interface using WCF, to allow 3rd
I'm experimenting with CSS Transitions these days. I'm trying to build an animated web
I'm trying to build a single page web based application, so the entire UI
I am trying to build multiple timers for my web page, so far I

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.