如何将子域重定向到另一个网站? [英] How to redirect a subdomain to another website?

查看:265
本文介绍了如何将子域重定向到另一个网站?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从godaddy.com购买了域名www.mydomain.com。我托管在www.000webhost.com(免费网站托管网站)。我创建了一个subdomain.mydomain.com通过ccpanel的000webhost。



我希望该子域名转移到我的博客 http://myblog.blogspot.in/



现在我有一个名为 subdomain 在我的根文件夹。我应该在该文件夹中上传什么,以便将其重定向到我的博客?

解决方案

使用.htaccess文件或创建PHP脚本包含以下内容:

 <?php 
header('HTTP / 1.1 301 Moved Permanently'
header('Location:http://the-network-king.blogspot.in');

创建301重定向。



并将文件保存在名称 index.php 下,否则它不会选择文件。


I bought domain www.mydomain.com from godaddy.com. I hosted it at www.000webhost.com (free web-domain-hosting site). I created a subdomain subdomain.mydomain.com through ccpanel of 000webhost.

I want that subdomain to be diverted to my blog http://myblog.blogspot.in/

Right now I have a folder named subdomain in my root folder. What shall I upload in that folder so that It gets redirected to my blog?

解决方案

Use either a .htaccess file or create a PHP script with the following:

<?php
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://the-network-king.blogspot.in');

To create a 301 redirect.

and save the file under name index.php else it wont pick up file.

这篇关于如何将子域重定向到另一个网站?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆