Reply To: Redirect buddypress registration page using functions.php
Hello
I tried to redirect my subdomain registration page on [multsite] to the main domain site registration page. I used the following code in my child theme functions.php for the site which I want to redirect its registration page:
//redirect to the registration page
function MyRedirect() {
if(is_page('register')) {
wp_redirect( 'http://domain.com/register/', 301 );
exit;
}
}
add_action('template_redirect','MyRedirect');
Interestingly, the above code did not work, .htaccess is not working as well. I am, for sure, missing something but I don’t know what! .htaccess code is:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^sub\.domain\.com$
RewriteRule ^register/(.*)$ http://domain.com/register/$1 [R=301,L]
Any help from you is highly appreciated as I am really stuck in this.
Thanks in advance for all of you specially: @djpaul , @boonebgorges , @henrywright , @r-a-y , @danbp , @modemlooper , @imath , @shanebp .
Jessica