AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 35207
Accepted
Henrik P. Hessel
Henrik P. Hessel
Asked: 2009-07-03 10:23:26 +0800 CST2009-07-03 10:23:26 +0800 CST 2009-07-03 10:23:26 +0800 CST

Apache2 不断重定向

  • 772

我试图让用户使用 url www.mydomain.de,但 Apache 使用 301 永久重定向到 mydomain.de。我该如何防止这种情况发生?

虚拟主机的 httpd.include

<VirtualHost xx.xx.xx.xx:80>
    ServerName   mydomain.de:80
    ServerAlias   www.mydomain.de
    UseCanonicalName off
    SuexecUserGroup         mydomain psacln
    ServerAdmin  "[email protected]"
    DocumentRoot /var/www/vhosts/mydomain.de/httpdocs
</VirtualHost>

DNS 设置

    ; *** This file is automatically generated by Plesk ***
    $TTL    86400

    @       IN      SOA     ns.mydomain.de. info.mydomain.de. (
                            1246541440      ; Serial
                            10800   ; Refresh
                            3600    ; Retry
                            604800  ; Expire
                            360 )   ; Minimum

    mydomain.de.           IN NS   ns.mydomain.de.
    mydomain.de.              IN NS   ns2.hans.hosteurope.de.
    ns.mydomain.de.                IN A    92.51.134.24
    mydomain.de.           IN A    92.51.134.24
    webmail.mydomain.de.           IN A    92.51.134.24
    mail.mydomain.de.              IN A    92.51.134.24
    science.mydomain.de.           IN A    92.51.134.24
    test.mydomain.de.              IN A    92.51.134.24
    testing.mydomain.de.           IN A    92.51.134.24
    ftp.mydomain.de.               IN CNAME        mydomain.de.
    www.mydomain.de.               IN CNAME        mydomain.de.
    *.webmail.mydomain.de.                 IN CNAME        mydomain.de.
    mydomain.de.           IN MX  10 mail.mydomain.de.
    mydomain.de.           IN TXT  "v=spf1 +a +mx -all"

任何想法,为什么会这样?谢谢!

编辑:感谢 Chaos 的输入(还不能投票给你的答案),但不幸的是,它仍然不起作用。

Fiddler2 输出

GET / HTTP/1.1
Accept: */*
Accept-Language: de
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 4.0.20506; InfoPath.2; .NET CLR 3.0.30729)
Host: www.mydomain.de
Proxy-Connection: Keep-Alive


HTTP/1.0 301 Moved Permanently
Date: Thu, 02 Jul 2009 18:38:34 GMT
Server: Apache/2.2.8 (Ubuntu) DAV/2 SVN/1.5.1 mod_ssl/2.2.8 OpenSSL/0.9.8g mod_python/3.3.1 Python/2.5.2 PHP/5.2.10 mod_perl/2.0.3 Perl/v5.8.8
X-Powered-By: PHP/5.2.10
X-Pingback: http://mydomain.de/xmlrpc.php
Location: http://mydomain.de/
Content-Length: 0
Content-Type: text/html; charset=UTF-8
X-Cache: MISS from dezntpx01.computacenter.de
X-Cache-Lookup: MISS from dezntpx01.computacenter.de:8081
X-Cache: MISS from dezntpx03.computacenter.de
X-Cache-Lookup: MISS from dezntpx03.computacenter.de:8081
Via: 1.0 dezntpx01.computacenter.de:8081 (squid/2.7.STABLE5), 1.0 dezntpx03.computacenter.de:8081 (squid/2.7.STABLE5)
Connection: keep-alive
Proxy-Connection: keep-alive
linux apache-2.2 configuration
  • 1 1 个回答
  • 1032 Views

1 个回答

  • Voted
  1. Best Answer
    chaos
    2009-07-03T10:32:00+08:002009-07-03T10:32:00+08:00

    嗯,首先是这样的:

    ServerName   mydomain.de:80
    ServerAlias   www.mydomain.de
    

    需要是这样的:

    ServerName    www.mydomain.de
    ServerAlias   mydomain.de
    

    UseCanonicalName应该也可以。如果您想将它们保留在网站的一个版本上,它会帮助您,而不是伤害您。

    编辑:好的,问题是您的 Apache 服务器甚至没有控制您所看到的行为;您正在与之交谈的代理是。为什么决定抛出 301 重定向尚不清楚,但可能是因为它www.mydomain.de是一个CNAME记录。我会尝试把它A记录下来。

    代理也可能需要一些任意时间才能注意到您正在做的任何事情并调整其行为。据我所知,它也可能有实际配置的规则,告诉它www从你的域中剥离。

    • 3

相关问题

  • 你最喜欢的 Linux 发行版是什么?[关闭]

  • mod_rewrite 不转发 GET 参数

  • 更改 PHP 的默认配置设置?

  • 保护新的 Ubuntu 服务器 [关闭]

  • (软)Ubuntu 7.10 上的 RAID 6,我应该迁移到 8.10 吗?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    从 IP 地址解析主机名

    • 8 个回答
  • Marko Smith

    如何按大小对 du -h 输出进行排序

    • 30 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    Windows 中执行反向 DNS 查找的命令行实用程序是什么?

    • 14 个回答
  • Marko Smith

    如何检查 Windows 机器上的端口是否被阻塞?

    • 4 个回答
  • Marko Smith

    我应该打开哪个端口以允许远程桌面?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    MikeN 在 Nginx 中,如何在维护子域的同时将所有 http 请求重写为 https? 2009-09-22 06:04:43 +0800 CST
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    0x89 bash中的双方括号和单方括号有什么区别? 2009-08-10 13:11:51 +0800 CST
  • Martin Hope
    kch 如何更改我的私钥密码? 2009-08-06 21:37:57 +0800 CST
  • Martin Hope
    Kyle Brandt IPv4 子网如何工作? 2009-08-05 06:05:31 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve