且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将子域重定向到另一个网站?

更新时间:2023-01-08 13:34:01

使用.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.