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

  1. add ob_start single.php first line before get_header()
  2. 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

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -