开发者

redirect subdomain and retain url structure

开发者 https://www.devze.com 2023-04-05 18:28 出处:网络
I\'m redirecting a wordpress blog that lived in a subdomin to my root.when i visit links from my old blog, they just redirect to the index page of my blog, but i need them to redirect to the actual po

I'm redirecting a wordpress blog that lived in a subdomin to my root. when i visit links from my old blog, they just redirect to the index page of my blog, but i need them to redirect to the actual post. for example -

sub.mysite.com/1/2/3 - should redirect to -开发者_Python百科  mysite.com/sub/1/2/3

how can this be done? thanks!

UPDATE - still haven't found a solution for this. Anyone?

OR is there another post here that already exists that will show me the correct way to do this? THANKS!


The alternative approach is by editing your web server configuration.

Apache's rewrite rules can do this. You most likely have a .htaccess file in the root directory of your blog. Append the text below to it. If there is no such file, create one.

RewriteEngine On
RewriteCond %{HTTP_HOST} sub.mysite.com
RewriteRule ^(.*)$ http://mysite.com/sub$1 [R=permanent,L]

Your web server has to be configured to accept this configuration from a .htaccess file. It can also be placed in the configuration directly. The procedure for this differs depending on your web host.


The Wordpress Redirection plugin should be able to do exactly what you need.

If it doesn't, you can also accomplish this using your web server's configuration, but it's more complex to set up. See my second answer on this page.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号