如何将域重定向到其他页面或目录?

时间:2009-02-16 12:10:00

标签: web-hosting

请建议使用.htaccess以外的其他方法..

4 个答案:

答案 0 :(得分:7)

今天真的是作业日。

Theres httpd.conf(apache) http://httpd.apache.org/docs/1.3/configuring.html

或者,强制“错误301 - 重定向”。

或者,您可以在网页中将元刷新重定向到新网页。 例如
< meta http-equiv =“REFRESH”content =“0; url = http://www.the-domain-you-want-to-redirect-to.com”>

或者您可以使用javascript强制重定向。

<script type="text/javascript">
window.location = "http://www.google.com/"
</script>

然后有像逆向代理这样的东西可以做你想要的。

答案 1 :(得分:2)

根据技术和/或您对Web服务器的访问权限,有多种选择。除了上述内容,您还可以使用服务器端代码重定向,例如在ASP.Net

Response.Redirect("http://www.google.co.uk")

我确信有PHP和各种其他代码替代方法可以执行相同的操作。

答案 2 :(得分:1)

您可以使用index.html和META Refresh标记进行客户端重定向。

    <html>
        <head>
            <meta http-equiv="refresh" content="0;url=http://www.mysite.com/MyDir/MyPage.html" />
        </head>
    </html>

http://en.wikipedia.org/wiki/Meta_refresh

答案 3 :(得分:0)

实施无关的:

以下状态代码可用于Web服务器响应:

如果您无法访问体面的Web服务器,请尝试使用Javascript 或上面的Meta-Tag方法。

Bonus:使用Hunchentoot

的另一个特定于实现的建议
(redirect "http://otherhost/otherpath")