Page 1 of 1

Error 404, Help!!!!

PostPosted: 18. August 2010 13:58
by inoma
Please help,I'm new to xampp but I've tried frantically to resolve this error but to no avail.
My virtualHost and file settings are as followed:

NameVirtualHost 127.0.0.1

<VirtualHost 127.0.0.1>
ServerName site1.local
DocumentRoot "C:/MyWeb/Site1"#This is where my site is located and xampp is also in C:/MyWeb
</VirtualHost>

<VirtualHost 127.0.0.1>
ServerName site2.local
DocumentRoot "C:/MyWeb/Site2"
</VirtualHost>

<Directory "C:/MyWeb/site1">
Order Deny,Allow
Allow from all
</Directory>

<Directory "C:/MyWeb/site2">
Order Deny,Allow
Allow from all
</Directory>
My hosts file settings(windows) are as followed:

127.0.0.1 localhost:80
127.0.0.1 site1.local
127.0.0.1 site2.local
Any assistance to get around this would be much appreciated.

Re: Error 404, Help!!!!

PostPosted: 18. August 2010 14:28
by Nobbie
inoma wrote:Any assistance to get around this would be much appreciated.


Around what? There is no question nor any error description in your posting.

Re: Error 404, Help!!!!

PostPosted: 18. August 2010 15:22
by BigWetDog
I'm with nobie on this one. You haven't actually indicated what your problem is.
So please tell us:
1. What behavioiur is occuring? (404 when requesting what URL?)
2. What behaviour is expected?
3. Was apache serving prior to implementing virtual hosts?
4. Are you also using mod_jk?

In the absence of this information all I can do is suggest you take a look at the Apache virtual hosts documentation on the httpd.apache.org site.

Re: Error 404, Help!!!!

PostPosted: 19. August 2010 10:21
by inoma
BigWetDog wrote:I'm with nobie on this one. You haven't actually indicated what your problem is.
So please tell us:
1. What behavioiur is occuring? (404 when requesting what URL?)
2. What behaviour is expected?
3. Was apache serving prior to implementing virtual hosts?
4. Are you also using mod_jk?

In the absence of this information all I can do is suggest you take a look at the Apache virtual hosts documentation on the httpd.apache.org site.


What I want to achieve is to have like 3 virtual hosts on the same server, with the same ip address-127.0.0.1
the name-based virtual hosts I'm using are site1.local and site2.local aside the default localhost. site1.local is located in C:\MyWeb\site1.local and site2.local is in C:\MyWeb\site2.local while apache is in C:\MyWeb\xampp.

On entering the address site1.local in a browser I get, "The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.If you think this is a server error, please contact the webmaster.
Error 404
site1.local
8/19/2010 10:09:03 AM
Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1"
The expected result on entering site1.local is to display the index page in site1.local and yes apache is still serving on entering localhost in the browser.
Thanks in anticipation.

Re: Error 404, Help!!!!

PostPosted: 19. August 2010 11:03
by Nobbie
inoma wrote:Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1"


The good news: your Apache is up and answers correctly.

The bad news: you configured it insufficiently

As you can see, a couple of modules (like mod_ssl, mod_autoindex_color etc.) have been loaded. BUT: there is missing "mod_dir".

inoma wrote:The expected result on entering site1.local is to display the index page in site1.local


For that behaviour you need a couple of prerequisites:

a) there must be an index page file in the DocumentRoot of that vhost, either index.php or index.html
b) you must have an entry "DirectoryIndex" in your httpd.conf, which contains at least index.php and/or index.html
c) the above directive works ONLY IF you have loaded mod_dir into to your Apache environment (what is not given actually)
d) if you are omitting the closing slash (http://site1.local instead of http://site1.local/), the value of DirectorySlash (in httpd.conf) MUST NOT be "Off". As "On" is the default value, you simply may drop this directive.

Last not least (what does not affect your problem, but is wrong anyway), you must edit your hosts file and specify localhost correctly (you MUST NOT specify any ports there):

Code: Select all
127.0.0.1     localhost

Re: Error 404, Help!!!!

PostPosted: 19. August 2010 12:42
by inoma
mod_dir is on i.e. the line on mod_dir in httpd looks like-LoadModule dir_module modules/mod_dir.so
DirectoryIndex has index.php and index.htm but still no changes same error message.
Also BackSlash is also not on.

Re: Error 404, Help!!!!

PostPosted: 19. August 2010 13:59
by BigWetDog
Do you have a default page ( index.php|htm ) in C:\MyWeb\site1.local and in C:\MyWeb\site2.local ?
And are you using mod_jk?

Re: Error 404, Help!!!!

PostPosted: 19. August 2010 16:25
by Nobbie
inoma wrote:mod_dir is on i.e. the line on mod_dir in httpd looks like-LoadModule dir_module modules/mod_dir.so
DirectoryIndex has index.php and index.htm but still no changes same error message.
Also BackSlash is also not on.


Are you staring at the wrong httpd.conf? The error message clearly states that there is NO mod_dir loaded.

Re: Error 404, Help!!!!

PostPosted: 08. September 2010 05:48
by TrevDev
Nobbie's 19 August 2010 posting gave me the clue that solved the Error 404 problem for me. I had an old installation of xampp that I had forgotten about, on a different drive. It had never been uninstalled and the Apache service was auto-starting, so http:\\localhost was looking in the htdocs folder in the old installation, not my new one. Duh!!! :oops: