我有一个网站example.com
,另一个网站test.example.com
。两者都有不同的配置文件。但是当我输入网址test.example.com
时,它会重定向到example.com
。
configuration file for example.com
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
DirectoryIndex index.html
DocumentRoot example-document-path
Options -Indexes
ErrorDocument 404 /errors/404.html
ErrorDocument 403 /errors/404.html
<Location "/">
SetHandler python-program
PythonHandler django.core.handlers.modpython
PythonPath "['path', 'path'] + sys.path"
SetEnv DJANGO_SETTINGS_MODULE example.settings
PythonInterpreter example
PythonAutoReload On
PythonDebug On
</Location>
</VirtualHost>
test.example.com的Apache配置文件
<VirtualHost *:80>
ServerName test.example.com
ServerAlias www.test.example.com
DirectoryIndex index.html
DocumentRoot test-example-document-path
Options -Indexes
ErrorDocument 404 /errors/404.html
ErrorDocument 403 /errors/404.html
<Location "/foo/bar/">
SetHandler python-program
PythonHandler django.core.handlers.modpython
PythonPath "['path', 'path'] + sys.path"
SetEnv DJANGO_SETTINGS_MODULE example.settings
PythonInterpreter example
PythonAutoReload On
PythonDebug On
</Location>
</VirtualHost>
root url test.example.com重定向到我不想要的example.com? 我怎么没有头绪?任何人都可以提出建议吗?
提前致谢。
答案 0 :(得分:2)
首先猜测是缓存问题,第二个猜测是test.example.com上的index.html
(或.php
或其他)文件。如果它不是其中之一,请运行:
$ curl -vvv test.example.com
看看它发回的标题。他们会给你一些关于重定向性质的线索。如果这不能解决问题,请在此处发布输出。
编辑:好的,如果你从Apache获得302,那么只有有限数量的东西可以负责。想到的事情是:
.htaccess
test.example.com
root 中的文件
Apache配置中的Redirect
和Alias
指令(egrep -R 'Redirect|Alias' /etc/apache2/
)ModRewrite
使用重定向(egrep -R '\bR\b' /etc/apache2/
)此外,验证您实际与您希望与之交谈的服务器进行通信(例如curl http://test.example.com/blahblahblah
,然后grep访问日志blahblahblah
)。
答案 1 :(得分:0)
这很可能与DNS设置有关。我怀疑它与Apache有什么关系。可能有一个别名记录将test.example.com指向example.com或将* .example.com指向example.com的通配符别名记录。