httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject Re: [users@httpd] Any url will revert to the document root
Date Wed, 20 Aug 2008 08:15:52 GMT
Luc Landreville wrote:
> Greetings;
> 
> I host a website using apache on CentOS Linux. I am experiencing the fllowing problem:
> 
> Any file name added after the domain name in the address field of a browser is ignored
and the site's home page is displayed:
> 
> If I type http://www.mydomain.com/pt/index.html , apache will systematically display
the root directory index.html file (http://www.mydomain.com/index.html) with the folling entry
from the log file:
> [19/Aug/2008:18:18:57 -0400] "GET / HTTP/1.1" 200 5150 "http://www.mydomain.com.com/pt/index.html";
"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.16) Gecko/20080702 Firefox/2.0.0.16"
> 
> 
> However, if I enter the ip address ( http://99.99.99.99/pt/index.html) , I get the expected
file from the server with the following entry in the log file:
> [19/Aug/2008:18:24:37 -0400] "GET /pt/index.html HTTP/1.1" 200 5294 "-" "Mozilla/5.0
(Windows; U; Windows NT 5.1; en-US; rv:1.8.1.16) Gecko/20080702 Firefox/2.0.0.16"
> 
Can you post your whole httpd.conf file ?
It sounds like some issue of mismatch in virtual server names, or like 
some configuration issue in the virtual server "www.mydomain,com", but 
it's hard to tell what just by your report above.

If you want to figure it out for yourself, the point is probably this :

I assume that you do not actually have a line in your configuration saying
ServerName 99.99.99.99

So, what happens when you send a request to "http://99.99.99.99", is this :
- the request arrives at the Apache server
- Apache tries to match the request hostname (99.99.99.99) to one of the 
"ServerName" or "ServerAlias" in the various Virtual Servers defined.
- it fails, because there is no such ServerName or ServerAlias anywhere
- thus, it defaults to the first Virtual Server defined in your 
configuration, whatever that is, and applies the rules there.
(the very first <VirtualHost> section acts as a default for any hostname 
that Apache cannot find a real match for)

On the other hand, when you send a request to "http://www.mydomain.com", 
then what happens is this :
- the request arrives at the Apache server
- Apache tries to match the request hostname (www.mydomain.com) to one 
of the "ServerName" or "ServerAlias" in the various Virtual Servers defined.
- it succeeds, because there exists a <VirtualHost> section where there 
is a "ServerName www.mydomain.com" line.
- thus, apache uses that (other) virtual server configuration to serve 
the request, and applies the rules there

I can thus only imagine that the rules applied in the www.mydomain.com 
case, are such that a request to /pt/indx.html in that virtual server, 
gets "translated" to /index.html.
While in the default virtual server, it is not translated.


André




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message