Welcome Guest, Not a member yet? Register   Sign In
Problem when running my app with a different base URL

(This post was last modified: 03-22-2020, 02:49 AM by jreklund.)

Hello everyone,

I have just started to learn CodeIgniter 4 and I have gone through the online documentation.
I am using the local development server that comes with CodeIgniter 4 to host my web app locally.
I have also set the variable CI_ENVIRONEMENT in my .env file to development.

Following the documentation, I have set my base URL to "http://tutorial.ci/" in the file app/Config/App.php and also within the .env file, the baseURL has been set as app.baseURL="http://tutorial.ci/".
Note that I have uncommented the app.baseURL line.

So my first question is, after launching the server, why does the server is still starting on http://localhost:8080 despite modifying the baseURL?

And my second question is, why can't I access the web app in my browser via the link "http://tutorial.ci/"?

Kindly find as attachement of the  .env and app/Config/App.php files.
I will be very grateful if someone could help me to solve this issue as I am a complete novice to CodeIgniter.  Smile
Thanks in advance

Best Regards,

Attached Files
.php   App.php (Size: 9.55 KB / Downloads: 0)
.txt   env file.txt (Size: 3.26 KB / Downloads: 1)

(This post was last modified: 03-22-2020, 08:06 AM by InsiteFX.)

If you want to run with a base url like that then you need to use vhosts file.

Which is under Apache server.

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/your_project_root_folder"
    ServerName tutorial.ci
    ServerAlias tutorial.ci
    <Directory "C:/xampp/htdocs/your_project_root_folder">
        Order allow,deny
        Allow from all
        AllowOverride All
        Require all granted
Your vhost would like something like that.

If you are on Windows you need to edit the windows hosts file.


Using notepad and add this.    tutorial.ci
or (IP verison 6)
::1    tutorial.ci

You should install either WAMP or XAMPP depending on your needs.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )

(This post was last modified: 03-28-2020, 10:46 AM by Umar.)

Thanks for the reply.
I have followed the instructions that you have given as well as an online tutorial on how to setup a Virtual Host in Windows: https://ultimatefosters.com/hosting/setu...pp-server/

Despite all of these, the page Index of/ is appearing when I launch the link www.tutorial.ci

Kindly find as attachements the host, http.conf, httpd-vhosts.conf files which I have modified.
Could you please advice?
Thanks in advance

Attached Files
.txt   hosts.txt (Size: 858 bytes / Downloads: 0)
.txt   httpd_conf.txt (Size: 21.3 KB / Downloads: 0)
.txt   httpd-vhosts_conf.txt (Size: 1.66 KB / Downloads: 0)

Theme © iAndrew 2016 - Forum software by © MyBB