Always return the same ServerName??

Always return the same ServerName??

Post by eagan » Fri, 05 Oct 2001 13:23:19



I'm running 1.3.19 on RedHat 7.1. Everything's working great, but if a user
types my ip address into there URL bar, I'd like Apache to return the "www" name
(DNS name) of my server.

For example, with the following requests:
http://xx.xx.xx.xx (a single IP, but both public and private IP space)
http://server.domain.com
http://www.domain.com

I want the user to see http://www.domain.com in their URL bar. Is there a way to
do this?

I have only one domain and one static ip. I'm not using Virtual Hosts, and that
seems like overkill for what I want to do and I'm not really sure if it helps
me. At first I thought that the ServerName directive would take care of this,
since it's for creating redirection URLs. But how do I force the redirection
when the request is like http://192.168.1.1 ??

Thanks,
Mike

 
 
 

Always return the same ServerName??

Post by Joshua Sliv » Fri, 05 Oct 2001 23:46:44



> I'm running 1.3.19 on RedHat 7.1. Everything's working great, but if a user
> types my ip address into there URL bar, I'd like Apache to return the "www" name
> (DNS name) of my server.
> For example, with the following requests:
> http://xx.xx.xx.xx (a single IP, but both public and private IP space)
> http://server.domain.com
> http://www.domain.com
> I want the user to see http://www.domain.com in their URL bar. Is there a way to
> do this?

There are two options: Configure name-vhosts with just a Redirect
in the non-canoncial ones or use mod_rewrite.  There is a mod_rewrite
example in the rewrite guide under "canonical hostnames":
http://httpd.apache.org/docs/misc/rewriteguide.html

--
Joshua Slive

http://slive.ca/

 
 
 

1. APACHE: ServerName is not returned

I haven't been able to get Apache 1.0.5 to return correct
servername. I have in http.conf line:
ServerName www.our.dom.ain

But if I connect to our site using name host.our.dom.ain
then this name is used. Our Web-server is running on
RedHat Linux 3.0.3 - kernel 2.0.0 (happened also with 1.2.13).
I have tested this using Netscape 2.02 (Linux) and 1.1N (SunOS)
so it's possible it's Netscape not Apache...

Thanks in advance.

--

2. matrox rainbow runner

3. (?) CGI script not always returning data

4. Can I pipe to the passwd command?

5. Nameserver - Is it possible to return always the same IP?

6. Laser Writer??????

7. swapctl() always returns same free swap

8. Printing only odd/even pages of postscript

9. nlist() always returns -1 but errno=0 on Solaris7&8

10. utmpxname() function always returns a 1

11. "su" always returns 0

12. clock returns 10000 always?

13. syscall mmap() always returns error