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 - 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.
来源:https://stackoverflow.com/questions/7475249/redirect-subdomain-and-retain-url-structure