CodeIgniter Forums
CI4 virtual host problem - 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: CI4 virtual host problem (/thread-74984.html)



CI4 virtual host problem - muuucho - 12-04-2019

The docs states in "Codeigniter4 overview / Application structure / public" that 

"This folder is meant to be the “web root” of your site, and your web server would be configured to point to it.

So I have setup a virtual host like this for my project "ci4" that resides in htdocs of my xampp installation. I am on windows 10.

httpd-vhosts.conf
Code:
NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot "c:/xampp/htdocs/ci4/public"
ServerName ci4.local
<Directory "c:/xampp/htdocs/ci4/public">
</Directory>
</VirtualHost>
hosts
Code:
127.0.0.1       localhost
::1             localhost
127.0.0.1     ci4.local
I can now enter my codeigniter project by requesting "ci4.local/". That works fine. But when I try to visit xampp's dashboard by requesting simply "localhost" I am served codeigniter's welcome page. What is wrong?


RE: CI4 virtual host problem - Armin - 12-04-2019

(12-04-2019, 03:35 AM)muuucho Wrote: The docs states in "Codeigniter4 overview / Application structure / public" that 

"This folder is meant to be the “web root” of your site, and your web server would be configured to point to it.

So I have setup a virtual host like this for my project "ci4" that resides in htdocs of my xampp installation. I am on windows 10.

httpd-vhosts.conf
Code:
NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot "c:/xampp/htdocs/ci4/public"
ServerName ci4.local
<Directory "c:/xampp/htdocs/ci4/public">
</Directory>
</VirtualHost>
hosts
Code:
127.0.0.1       localhost
::1             localhost
127.0.0.1     ci4.local
I can now enter my codeigniter project by requesting "ci4.local/". That works fine. But when I try to visit xampp's dashboard by requesting simply "localhost" I am served codeigniter's welcome page. What is wrong?

you have set multiple virtual host but different ServerName, like this:

httpd-vhosts.conf
Code:
NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot "c:/xampp/htdocs/localhost/public"
ServerName localhost
<Directory "c:/xampp/htdocs/localhost/public">
</Directory>
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "c:/xampp/htdocs/ci4/public"
ServerName ci4.local
<Directory "c:/xampp/htdocs/ci4/public">
</Directory>
</VirtualHost>



RE: CI4 virtual host problem - InsiteFX - 12-04-2019

Read this may help you out, I had to rename index.php to index.php.sav so that it
did not keep going to the dashboard.

Xampp localhost/dashboard


RE: CI4 virtual host problem - muuucho - 12-04-2019

(12-04-2019, 08:51 AM)InsiteFX Wrote: Read this may help you out, I had to rename index.php to index.php.sav so that it
did not keep going to the dashboard.

Xampp localhost/dashboard
My problem is that I can't reach XAMPP's dashboard. If I request "localhost" I expect to see the dashboard of Xampp, instead I get codeigniter's welcome page.

Solved: the httpd-vhosts.conf shall be like this:
Code:
NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot "c:/xampp/htdocs/ci4/public"
ServerName ci4.local
<Directory "c:/xampp/htdocs/ci4/public">
</Directory>
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "c:/xampp/htdocs"
ServerName localhost
<Directory "c:/xampp/htdocs">
</Directory>
</VirtualHost>