0

Before I had a single wordpress on a .com domain. But I switched to multiliste for having regional websites. I now still have this .com website working and I created a copy of it in the subdirectory .com/en/ So now my plan is to do a permanent redirection from all the pages of my .com to the new .com/en/ pages.

I tried many ways using redirection plugins, codes in .htaccess and even tried the code below in the functions.php of my theme. But no success ! I was just able to redirect all the pages of the .com to the .com/en/ homepage.

<?php
function wpse66115_redirect_to_sub_site() {
  if ( is_main_site() ) {
    exit( wp_redirect( 'http://www.example.com/main-site/sub-site/', 301 ) );
  }
}
add_action( 'parse_request', 'wpse66115_redirect_to_sub_site' );
?>

Any idea how I can do it ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.