CodeIgniter Forums
Codeigniter with several webs - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: General Help (https://forum.codeigniter.com/forum-24.html)
+--- Thread: Codeigniter with several webs (/thread-75640.html)

Pages: 1 2


Codeigniter with several webs - Entai - 02-28-2020

Hi, I want to use codeigniter as root of several webs, my question is about how to rewrite the URL with apache2 for the controllers!?

My webserver is an instance in AWS Lightsail, and I use Apache 2.4 and codeigniter 3.1.11


RE: Codeigniter with several webs - John_Betong - 02-28-2020

I am not familiar with AWS Lightsale but do use an Apache2 VPS.

I have use common directory /var/www/ci2/  which contains the latest couple of CI Versions (and a few other common librarie).

Each CI domain has an index.php system link to the CI version system path.

I have set an index.php constant to the CI4 system path and set it in the App/Config/setup.php (I think from memory).

Tentatively tapped on a tablet Sad


RE: Codeigniter with several webs - Entai - 02-28-2020

(02-28-2020, 05:43 PM)John_Betong Wrote: I am not familiar with AWS Lightsale but do use an Apache2 VPS.

I have use common directory /var/www/ci2/  which contains the latest couple of CI Versions (and a few other common librarie).

Each CI domain has an index.php system link to the CI version system path.

I have set an index.php constant to the CI4 system path and set it in the App/Config/setup.php (I think from memory).

Tentatively tapped on a tablet Sad

Can you please put the example of the index.php and setup.php files?


RE: Codeigniter with several webs - John_Betong - 02-28-2020

@Entai

Try this and see if it answers your queries:

https://ci4-strict.tk/bugs-fixed


RE: Codeigniter with several webs - Entai - 02-28-2020

(02-28-2020, 05:58 PM)John_Betong Wrote: @Entai

Try this and see if it answers your queries:

https://ci4-strict.tk/bugs-fixed

I need CI 3, had all the websites and controllers on that version Sad


RE: Codeigniter with several webs - John_Betong - 02-28-2020

@Entai.

Code:
/*
*---------------------------------------------------------------
* SYSTEM DIRECTORY NAME
*---------------------------------------------------------------
*
* This variable must contain the name of your "system" directory.
* Set the path if it is not in the same directory as this file.
*/
# $system_path = 'system';
  # system_path = '/var/www/ci2/CodeIgniter-3-1-10/system';
  $system_path  = '/var/www/ci2/CodeIgniter-3-1-11/system';



RE: Codeigniter with several webs - Entai - 03-01-2020

(02-28-2020, 08:06 PM)John_Betong Wrote: @Entai.

Code:
/*
*---------------------------------------------------------------
* SYSTEM DIRECTORY NAME
*---------------------------------------------------------------
*
* This variable must contain the name of your "system" directory.
* Set the path if it is not in the same directory as this file.
*/
# $system_path = 'system';
  # system_path = '/var/www/ci2/CodeIgniter-3-1-10/system';
  $system_path  = '/var/www/ci2/CodeIgniter-3-1-11/system';

yup, that works!, I use not only the system path also the application path too, and in each web folder I put the views ... but is not accessing my controllers (other than welcome!) ... something is wrong ... still researching what Tongue


RE: Codeigniter with several webs - John_Betong - 03-01-2020

(02-28-2020, 01:18 PM)Entai Wrote: Hi, I want to use codeigniter as root of several webs, my question is about how to rewrite the URL with apache2 for the controllers!?

My webserver is an instance in AWS Lightsail, and I use Apache 2.4 and codeigniter 3.1.11
[off-topic]
Unable to reply to your message because the feature is disabled.

Hi,

I don't use WhatsApp .


Please use the forums for all queries so other users with similar problems will benefit from the solutions and results.

[/off-topic]


RE: Codeigniter with several webs - Entai - 03-02-2020

Ok, by now I can access the welcome controller and from there go to the view in the new views folder:

index.php in the /web1.com

$system_path = '/var/www/html/sistema/system';
$application_folder = '/var/www/html/sistema/application';   // <-- If I use only application it says don't have index.php
$view_folder = '/var/www/html/web1.com/views';

it works right, and can see the home ... but

when I try to go to web1.com/fotos it get apache 404 error
if I try to go to web1.com/index.php/fotos it get ci3 404 error

Where do I use the rewrite and how!?!?!?! for any web1.com/???

the controller fotos is "/var/www/html/sistema/application/controllers/Fotos.php" ...


RE: Codeigniter with several webs - John_Betong - 03-02-2020

@Entai,

> Ok, by now I can access the welcome controller and from there go to the view in the new views folder:

Take a look at the flow chart below which is very helpful.

https://codeigniter.com/user_guide/overview/appflow.html

Once you understand the flow look at the appplication routes.php file and make changes to the routes and try:
1. adding parameters to the existing welcome_message page
2. getting the parameters to show on the welcome page
3. duplicate the welcome page in the same folder and add a route to find the new page.
4. try duplicating the Home class, rename and make a route to the new class and to a new page.

Upon reflection try the News Tutorial which is very good and covers the above points.