How to create 301 Redirect for Subdomain

Home Forums BulletProof Security Free How to create 301 Redirect for Subdomain

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #15424
    Bruce Alfred

    I’ve got a number of 301 Redirects working OK  in my BPS Root htaccess file custom code in the Custom Code Bottom area, as recommended in other support posts. But, I can’t figure out how to get a subdomain to redirect to the new URL which is in the top level domain.  Here’s what I’ve tried for the redirect: Could you please tell me how to setup the redirect so the subdomain can go to the new URL as noted above. I will greatly appreciate any help you can offer.

     RedirectMatch 301 ^*)$


    AITpro Admin

    A subdomain is literally another separate domain and depending on which web host you have the redirect code needed will be different.

    This Forum is installed in a folder named “/forum/” and this Forum is a subdomain site with a DNS A record pointing to the “/forum/” folder.  “forums” with an “s” just happens to be the standard/default URL base for BuddyPress/bbPress.  Once again 2 completely different things.

    RedirectMatch 301 ^/forum/forums/topic/alexa-certify-gets-403-errors/$

    I am going to make some assumptions.  You have created a folder named “/harmony” and it is an official subdomain site with a DNS A or CNAME record pointing to /harmony.  You have also created another subfolder named /harmony under your main domain folder name.

    RedirectMatch 301 ^/harmony/(.*)$

    The RedirectMatch code would go in the .htaccess file in the subdomain “harmony” .htaccess file and NOT in your main domain’s .htaccess file. You are redirecting from your subdomain site to another website. If you add this RedirectMatch code under your main domain’s .htaccess file you will create an infinite redirect loop since the you have a subfolder under your main domain named /harmony.

    This code below would probably work on other Hosts, but it will not work on Go Daddy Hosting.  This code would go in the subdomain’s .htaccess file ONLY.

    RedirectMatch 301 ^/(.*)$
    Bruce Alfred

    Thanks so much for the quick and helpful response! This is one of the reasons I recommend BPS to anyone looking for WP security!


Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.