Change localhost:8080 to custom domain CI4 |
Hi,
I'm quite new in CI4, but use CI3 for view years. I saw a video on youtube where someone change app.php to set CI4 custom domain and remove index.php here's the link Code: https://www.youtube.com/watch?v=yoKTE5J5T7g this is how exactly i want CI4 work in my localhost (I'm using apache2) but, since i saw documentation of CI4 where i can run Code: php spark serve and my CI4 run when accesed from Code: localhost:8080 is there any way to change that Code: localhost:8080 Code: http://localhost/mypCI4 im trying to add in .env something like Code: app.baseURL=http://localhost/mypCI4 Thanks in advance
I recommend you set up Apache or something.
There is no way to change the path (`/mypCI4`).
If you set up Apache (for example WAMP www.wampserver.com) you can add virtual hosts. You can do this by adding a host name to the file hosts (in windows\system32\drivers\etc), for example:
Code: 127.0.0.1 mypCI4.local Code: <VirtualHost *:80> See https://noobietech.com/create-a-virtual-...p-windows/ You won't be able to use php spark serve this way, but you can setup multiple installations now. (11-27-2022, 02:03 AM)refs Wrote: So, is it mean that CI4 domain will stay like "localhost:8080" if i use php spark serve ? "php spark serve" is a server for development. You can change hostname (=localhost) and port number (=8080). See "php spark help serve" But there is no way to change the URI path. And if you change the hostname, the hostname must be resolved. For example, you need to add it in your hosts file. (11-27-2022, 02:03 AM)refs Wrote: and it's also mean i can't have multiple project using CI4 in same host ? If you mean you want to server like: http://example.com/project1/ http://example.com/project2/ You cannot use "php spark serve" because it cannot set the URI path (/project1/). But of course you can do it with Apache. (11-27-2022, 02:25 AM)JustJohnQ Wrote: If you set up Apache (for example WAMP www.wampserver.com) you can add virtual hosts. You can do this by adding a host name to the file hosts (in windows\system32\drivers\etc), for example: hmm,,interesting, okay, will try it (11-27-2022, 04:05 AM)kenjis Wrote:(11-27-2022, 02:03 AM)refs Wrote: So, is it mean that CI4 domain will stay like "localhost:8080" if i use php spark serve ? okay, thanks for the information kenjis
suggest using laragon (laragon.org). all out of the box (just make project under www folder, all automatic create domain each , project1.test, project2.test)
laragon, looks interesting if your on windows. But for the time you invest in it to understand it ; you could put into that time into thinking of looking into using Linux as your OS. The benefit of that is that most web servers were using Linux. (Not sure how cloud factors into this now)
So if you run Linux as your OS , you have as part of the system as web server. You will learn about permissions , chmod and the rest
Previously used MAMP-Pro that allows you to set hostnames from the program itself, you will have all tools at hand, Another solution would be to use Hosts file editor, easy to use and setup without any hassle on different OS. WAMP is another solution that allows you to edit virtual hosts in a simple way if you don't know how to handle this yourself.
Options: - https://www.mamp.info/en/mamp-pro/windows/ - https://www.wampserver.com/en/ - https://hostsfileeditor.com/ |
Welcome Guest, Not a member yet? Register Sign In |