重定向wordpress博客

I have a wordpress installation that is located in the root folder: mydomain.com

This website has a blog that is directed to mydomain.com/blog

What I would like to achieve is to redirect all traffic that goes to mydomain.com/blog to another wordpress installation that has a blog and located on a temporary domain on my server - server.myserverdomain.com/~seconsite/blog

I would like to also keep the main website domain mydomain.com/blog

Thanks !

What you can do is

Redirection by JavaScript

Make one file named index.html, in which put html,head and body tags and also put javascript code as below

<script>
window.location="http://UrlToRedirect";
</script>

Put this index.html file into your /www/blog directory or whichever directory you have for mydomain.com/blog.

And make sure you don't have any other file named as index in that directory except this one which you will prepare.

And you are good to go.

Redirect by PHP

header("Location: server.myserverdomain.com/~seconsite/blog");
die();

Redirect by HTML

Method 1 :

<meta http-equiv="refresh" content="0; url=http://server.myserverdomain.com/~seconsite/blog/" />

Method 2 :

<script>window.top.location = 'http://server.myserverdomain.com/~seconsite/blog';</script>