The "View" link I believe you were referring to isn't the only place the url should change so I took the liberty and changed them in the other spots as well.
This affects only published posts and pages.

It's quite a bit of code but this should do it.
// Change the "View" link on the all posts page. function my_custom_view_link( $actions, $page_object ) { $title = _draft_or_post_title(); $actions['view'] = sprintf( '<a href="%s" rel="permalink" aria-label="%s">%s</a>', my_custom_permalink( $post->ID ), esc_attr( sprintf( __( 'View “%s”', 'my-text-domain' ), $title ) ), __( 'View', 'my-text-domain' ) ); return $actions; } add_filter( 'post_row_actions', 'my_custom_view_link', 10, 2 ); // Change the "Post updated" link on the edit post page after saved. function my_custom_post_updated_messages( $messages ) { global $post_ID; $view_page_link_html = sprintf( ' <a href="%1$s">%2$s</a>', esc_url( my_custom_permalink( $post_ID ) ), __( 'View post', 'my-text-domain' ) ); $messages['post'][1] = __( 'Post updated', 'my-text-domain' ) . $view_page_link_html; return $messages; } add_filter( 'post_updated_messages', 'my_custom_post_updated_messages', 10, 1 ); // Change the "Post updated" link on the edit post/page after saved. function my_custom_post_preview_link( $return, $post_id, $new_title, $new_slug, $post ) { if ( 'publish' !== $post->post_status ) { return $return; } if ( false === strpos( $permalink, '%postname%' ) ) { $view_link = my_custom_permalink( $post_id ); $display_link = urldecode( $view_link ); $preview_target = " target='wp-preview-{$post->ID}'"; $return = '<strong>' . __( 'Permalink:', 'my-text-domain' ) . "</strong>\n"; $return .= '<a id="sample-permalink" href="' . esc_url( $view_link ) . '"' . $preview_target . '>' . esc_html( $display_link ) . "</a>\n"; } return $return; } add_filter( 'get_sample_permalink_html', 'my_custom_post_preview_link', 10, 5 ); // Replace the base url with a custom one. function my_custom_permalink( $post_id ) { return str_replace( home_url(), 'http://site2.com', get_permalink( $post_id ) ); }