# Redirect WordPress local development uploads, to dev/prod server.
RedirectMatch 301 ^/wp-content/uploads/(.*) http://mylivesite.com/wp-content/uploads/$1
<?php
/**
* Force old permalinks to a new page.
*/
function wds_client_301_redirect() {
// Get the URL.
$url = untrailingslashit( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
// Redirect to the correct page!
if ( is_404() && ( false !== strpos( $url, 'old-page-url' ) ) ) {
wp_redirect( 'https://new-url.com/new-page-url', 301 );
}
}
add_action( 'template_redirect', 'wds_client_301_redirect' );