Problem when running my app with a different base URL |
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. ![]() Thanks in advance Best Regards, Umar
If you want to run with a base url like that then you need to use vhosts file.
Which is under Apache server. Code: #-------------------------------------------------------------- Your vhost would like something like that. If you are on Windows you need to edit the windows hosts file. C:\Windows\System32\drivers\etc\hosts Using notepad and add this. 127.0.0.1 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 )
Hello,
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 |
Welcome Guest, Not a member yet? Register Sign In |