LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 691|回复: 3

有关apache访问加'/',和不加的问题

[复制链接]
发表于 2004-11-29 23:52:19 | 显示全部楼层 |阅读模式
如,我访问:
http://220.191.144.205/~user

(上面user后面没有加 / , 结果访问不了,打不开)

http://220.191.144.205/~user/

(这样就可以打的开了)

郁闷这是为什么??小弟在LINUX的APACHE下没有这样的问题的。

虽然有前辈给他以下的说明:
Why does accessing directories only work when I include the trailing "/" (e.g., http://foo.domain.com/~user/) but not when I omit it (e.g., http://foo.domain.com/~user)?

When you access a directory without a trailing "/", Apache needs to send what is called a redirect to the client to tell it to add the trailing slash. If it did not do so, relative URLs would not work properly. When it sends the redirect, it needs to know the name of the server so that it can include it in the redirect. There are two ways for Apache to find this out; either it can guess, or you can tell it. If your DNS is configured correctly, it can normally guess without any problems. If it is not, however, then you need to tell it.

Add a ServerName directive to the config file to tell it what the domain name of the server is.

The other thing that can occasionally cause this symptom is a misunderstanding of the Alias directive, resulting in an alias working with a trailing slash, and not without one. The Alias directive is very literal, and aliases what you tell it to. Consider the following example:

Alias /example/ /home/www/example/

The above directive creates an alias for URLs starting with /example/, but does not alias URLs starting with /example. That is to say, a URL such as http://servername.com/example/ will get the desired content, but a URL such as http://servername.com/example will result in a "file not found" error.

The following Alias, on the other hand, will work for both cases:

Alias /example /home/www/example


但是我还是不知道在httpd.conf里应该怎么配置,请前辈们帮帮忙了。
发表于 2004-11-30 00:42:23 | 显示全部楼层
 楼主| 发表于 2004-11-30 12:36:22 | 显示全部楼层
谢前辈指点,但是小弟试了没有用啊~~ 郁闷~~~~ 55555555
 楼主| 发表于 2004-11-30 17:31:00 | 显示全部楼层
同问一下,如果只让默认的加"/" 才可以访问,我感觉速度快的多,对服务器会不会减轻一点负载?感觉如果不加"/"的话,服务器还要转一下形式,变成加'"/"再去读目录?会多一步工作,不知道是不是酱子?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表