Localhost ok for 'www' but 404 for 'httpdocs' on XAMPP root

Problems with the Mac OS X version of XAMPP, questions, comments, and anything related.

Localhost ok for 'www' but 404 for 'httpdocs' on XAMPP root

Postby CarlosFreire » 19. March 2019 14:18

Hi everybody:

I used XAMPP 7.1.8-0, PHP Version 7.1.8 on MacOs 10.11.6
My problem: I have 3 sites on my localhost, 2 working fine, but one... error 404

file httpd-vhosts.conf:

Code: Select all
<VirtualHost *:80>
       DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/"
       ServerName localhost
</VirtualHost>
<VirtualHost *:80>
       DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/client1/www/"
       ServerName client1.localhost
</VirtualHost>
<VirtualHost *:80>
       DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/client2/www/"
       ServerName client2.localhost
</VirtualHost>
<VirtualHost *:80>
       DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/client3/httpdocs/“
       ServerName client3.localhost
</VirtualHost>


file [root] /etc/hosts
Code: Select all
127.0.0.1   localhost
255.255.255.255    broadcasthost
::1             localhost
#fe80::1%lo0   localhost
127.0.0.1   client1.localhost
127.0.0.1   client2.localhost
127.0.0.1   client3.localhost


Obs.: "client1, client2 and client3" are not the real names of the sites, only for demonstration.

In resume:

localhost.client1 -> ok
localhost.client2 -> ok

localhost.client3 -> page 404, but...
http://localhost/client2/httpdocs/ -> ok

Any idea? Thanks in advance,

Carlos
CarlosFreire
 
Posts: 4
Joined: 19. March 2019 13:54
Location: Rio de Janeiro, Brasil
XAMPP version: 7.3.6-2
Operating System: MacOs 10.13.6 [High Sierra]

Re: Localhost ok for 'www' but 404 for 'httpdocs' on XAMPP r

Postby Nobbie » 19. March 2019 20:48

CarlosFreire wrote:Any idea?


Yes, of course, super easy:

http://localhost/client2/httpdocs/ -> ok = /Applications/XAMPP/xamppfiles/htdocs/client2/httdpdocs/
http://localhost.client3 -> not ok = /Applications/XAMPP/xamppfiles/htdocs/client3/httpdocs/

Dont you see the difference? client2 versus client3

And actually, it is NOT localhost.client3, it is client3.localhost

You seem to be extremely confused and its a bad idea anyway, not to show us REAL data. You are showing wrong data and it makes everything worse. I dont help on hidden wrong data anymore.
Nobbie
 
Posts: 11153
Joined: 09. March 2008 13:04

Re: Localhost ok for 'www' but 404 for 'httpdocs' on XAMPP r

Postby CarlosFreire » 19. March 2019 21:29

Hi Nobble, thanks for your reply and sorry about my mistake on "details" :oops:
The corrected case is below [not so easy]:

In resume:
Code: Select all
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/client1/www/"
       ServerName client1.localhost

client1.localhost -> ok

Code: Select all
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/client2/www/"
       ServerName client2.localhost

client2.localhost -> ok

Code: Select all
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/client3/httpdocs/“
       ServerName client3.localhost

client3.localhost -> page 404, but...
http://localhost/client3/httpdocs/ -> ok

The problem is apparently easy to figure out: XAMPP is not recognizing the site with 'httpdocs' instead of 'www'.
And, as described, the configuration in XAMPP is apparently ok for all ...
Would it have something to do with Apache or php.ini?

Last but... sorry if I not showed the real sites names on my localhost: that is no matter, really - I think.

Carlos
CarlosFreire
 
Posts: 4
Joined: 19. March 2019 13:54
Location: Rio de Janeiro, Brasil
XAMPP version: 7.3.6-2
Operating System: MacOs 10.13.6 [High Sierra]


Return to XAMPP for Mac OS X

Who is online

Users browsing this forum: No registered users and 6 guests