wordpress - 301 Redirect only Posts not Pages -
i looking redirect posts , not pages , custom post types old domain new domain. posts instance http://www.example.com/post1
should go http://example1.com/post1
http://www.example.com/post1
should go http://example1.com/post1
the pages i.e. http://www.example.com/page1
should still functional
i can find alot of answers on moving blog sub directory along moving links not moving posts , not pages
edit there on 1000 posts looking dynamic way of doing this
thank help
the hack end using
- add ob_start single.php first line before get_header()
- add following code in functions.php
change example.com
site domain name
add_action('wp_head','redirectme'); function redirectme() { if ('post' === get_post_type()){ wp_redirect( 'http://example.com' . $_server['request_uri'] , 301 ); exit; } }
Comments
Post a Comment