免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1645 | 回复: 4
打印 上一主题 下一主题

有关apache访问加'/',和不加的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2004-11-29 23:53 |只看该作者 |倒序浏览
如,我访问:
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里应该怎么配置,请前辈们帮帮忙了。

论坛徽章:
0
2 [报告]
发表于 2004-11-30 12:39 |只看该作者

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

前辈,我要的什么?能不能详细一点点?谢谢了~~~~~~

论坛徽章:
0
3 [报告]
发表于 2004-11-30 17:16 |只看该作者

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

吼吼~~~~~~~~~~~~~~~~~ 没用~~~~~~~~~~~~ (昏)

为什么每一个人的说法都不一样啊~~

论坛徽章:
0
4 [报告]
发表于 2004-11-30 17:28 |只看该作者

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

同问一下,如果只让默认的加"/" 才可以访问,我感觉速度快的多,对服务器会不会减轻一点负载?感觉如果不加"/"的话,服务器还要转一下形式,变成加'"/"再去读目录?会多一步工作,不知道是不是酱子?

论坛徽章:
0
5 [报告]
发表于 2004-12-08 11:26 |只看该作者

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

呵呵呵,apache是完全匹配,如果你的虚拟目录加了"/",你么你访问的时候也得加"/"。

例如:虚拟目录是"abc/",那么就改成"abc",访问的时候就不用加"/"了。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP