免费注册 查看新帖 |

Chinaunix

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

[Web] 为什么访问apahche服务器时,地址后面一定要加“/” [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2003-02-22 00:48 |只看该作者 |倒序浏览
我的apache服务器,安装好以后
访问时,只有比如:http://www.aaa.com/aaa/
这样才可以访问
如果这样
                 http://www.aaa.com/aaa
就会找不到网页

不知道如何解决

大家帮忙啊。呵呵。

论坛徽章:
0
2 [报告]
发表于 2003-02-22 01:12 |只看该作者

为什么访问apahche服务器时,地址后面一定要加“/”

夜深了,人都睡觉了.

论坛徽章:
0
3 [报告]
发表于 2003-02-22 10:28 |只看该作者

为什么访问apahche服务器时,地址后面一定要加“/”

应该是你环境变量里,没有制当前路径,可以试试

论坛徽章:
0
4 [报告]
发表于 2003-02-22 10:41 |只看该作者

为什么访问apahche服务器时,地址后面一定要加“/”

[quote]原帖由 "linuxwl"]应该是你环境变量里,没有制当前路径,可以试试[/quote 发表:


不太明白,能说具体点吗?

论坛徽章:
0
5 [报告]
发表于 2003-02-22 11:03 |只看该作者

为什么访问apahche服务器时,地址后面一定要加“/”

有同样的困惑,顶一下

论坛徽章:
0
6 [报告]
发表于 2003-02-22 13:14 |只看该作者

为什么访问apahche服务器时,地址后面一定要加“/”

有人给了我这样一个回复
------------------------------------------------
这样的,你做目录alias的时候应该是
    Alias /aaa "/home/aaa"
或者
    Alias /aaa/ "/home/aaa/"

也就是要么都用/结束,要么都没有。

谁能具体点说说吗?
--------------------------------------------

可那个目录是在我的根目录下啊,我没有用Alias

论坛徽章:
0
7 [报告]
发表于 2003-02-26 01:27 |只看该作者

为什么访问apahche服务器时,地址后面一定要加“/”

你是APACHE吧?如果你的目录下没有默认主页,就会列出目录下的文件。

论坛徽章:
0
8 [报告]
发表于 2003-02-26 19:55 |只看该作者

为什么访问apahche服务器时,地址后面一定要加“/”

我也遇到相同的问题 哪位大哥知道如何弄呀?

论坛徽章:
0
9 [报告]
发表于 2003-02-27 00:19 |只看该作者

为什么访问apahche服务器时,地址后面一定要加“/”

你的Apache默认的根目录是aaa的上一级目录,你直接使用http://www.aaa.com/aaa apache会以为你是要访问aaa这个文件,而不是目录,这样当然就不行了

论坛徽章:
0
10 [报告]
发表于 2003-02-27 01:17 |只看该作者

为什么访问apahche服务器时,地址后面一定要加“/”

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.


from apache faq
英文的大意是..当你输入一个网址没有带/的时候,apache需要知道你的服务器名..然后会自动在后面添加一个/给客户端...它有两种方式完成这个过程..一个就是它自动识别...还有一个就是我们在conf文件中手动添加servername.
如果你的dns server配置正确就会没有问题...如果有问题我们可以手动在httpd.conf中的servername段中加入我们的server名.


举个例子:我的apache服务器地址是4lan.ods.org.平时输入地址都是没有问题的.但是我在上面弄个bbs的时候就有问题了...bbs.的地址为4lan.ods.org/bbs
平时我都要在后面加一个/才能正确访问...现在我手动在httpd.conf中加入servername 4lan.ods.org

这样我输入4lan.ods.org/bbs就可以了.....就是这么简单....

btw:我是动态ip...用dhcp的hostname会被自动分配成localhost.localdomain.....
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP