Redirecting parked domains

Home Forums BulletProof Security Free Redirecting parked domains

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #15542
    Keith
    Participant

    I’m a little surprised to learn that, if you park a domain on a website (e.g. a .com, .uk, .net with the same name), WordPress doesn’t automatically rewrite it to the domain specified in settings.  Well, it doesn’t on my WordPress site anyway, and that’s controlled by .htaccess written with BPS.

    I’ve just bought a new .uk domain, and I’ve parked it on the .co.uk website of the same name.  If I put the .uk address in the browser, it’s not rewritten, and hotlink protection blocks the images.  Ideally, I’d like the domain to be rewritten to the address in WP settings.

    I know how to do this in a standalone .htaccess file, but I’m dealing with a BPS .htaccess behemoth, and I don’t want to break it by putting my rewrite in the wrong place.  Can anyone suggest which custom code section to use, and what/where to insert, please?

    #15544
    AITpro Admin
    Keymaster

    “I’ve just bought a new .uk domain, and I’ve parked it on the .co.uk website of the same name”

    I’m not exactly sure what you are trying to do and why.  What is the intended goal.  Where is this website physically installed and where is it installed in relation to your other WordPress site – be specific with exact details.

    General Info about Domain Parking for help reference
    http://en.wikipedia.org/wiki/Domain_parking

    #15545
    Keith
    Participant

    It’s common practice in non-US countries to buy several versions of a domain, with different tlds and point them at the same website, 301-redirecting all but the primary domain.  This avoids “domain-squatting”.

    For example:
    For domain.com & domain.co.uk,
    domain.co.uk/abc  gives 301 redirect to  domain.com/abc

    On my BPS website, domain.uk is not being rewritten to domain.co.uk, even though this is the website address in WordPress settings.

    On other websites, I usually throw in a rewrite which checks %{HTTP_HOST} and rewrites appropriately, but how do I integrate this sort of rewrite successfully with the BPS custom code system?

    I have another WordPress site, which doesn’t use BPS, seems to be able to redirect domain.co.uk to domain.com fine, but it uses my domain rewrite code.

    #15547
    AITpro Admin
    Keymaster

    Ok this is the way I would do it and I will use an example of a domain that we purchased for this same reason so that someone does not buy that domain and cause confusion.  We purchased aitpro.com some years ago and it is pending either being setup as a redirect or possibly being used as the primary domain and the ait-pro.com domain being redirected to aitpro.com instead. At this point we prefer the hyphenated domain: ait-pro.com over the non-hyphenated domain: aitpro.com.

    I would create a folder named /aitpro.com in the root of my hosting account for this domain name that we have purchased.

    Instead of bothering to setup a WordPress website in that /aitpro.com folder I would just add an .htaccess file that redirects aitpro.com to ait-pro.com with this one line of .htaccess code below.

    Note: On our Host the physical folder name of an aliased domain MUST be in the RedirectMatch code or the redirect will NOT work correctly. /aitpro.com/ is the physical folder name where the site exists and is NOT the URL for the site.

    RedirectMatch 301 ^/aitpro.com/$ http://www.ait-pro.com/

    On other web hosts this RedirectMatch .htaccess code would probably work.

    RedirectMatch 301 ^/$ http://www.ait-pro.com/

    Also just for example sake and a hypothetical example scenario, let’s say that both the aitpro.com and ait-pro.com sites match identically – all posts and pages are exactly the same and you want to redirect all posts and pages from the aitpro.com domain to the ait-pro.com.

    You would use a Back Reference $1

    RedirectMatch 301 ^/aitpro.com/$ http://www.ait-pro.com/$1

    Other hosts that do not require the physical folder name in the RedirectMatch code

    RedirectMatch 301 ^/$ http://www.ait-pro.com/$1
    #15552
    Keith
    Participant

    Thanks. I’ll give that a try. It seems like there should be a simpler way around this, but if it works it works.

    Normally, I’d just do something along the lines of:

    RewriteCond %{HTTP_HOST} domain\.co\.uk$ [NC,OR]
     RewriteCond %{HTTP_HOST} ^www\. [NC]
     RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]

    I’d stick it in the site root .htaccess, and I wouldn’t need to point a secondary domain at a subdirectory.

    #15553
    AITpro Admin
    Keymaster

    Well that would work from the same domain if you have done all the DNS stuff in your host control panel.  You would need a DNS A record (or CName for an alias) pointing to the .uk domain to the .uk.co domain.  In this type of scenario you would be doing a domain migration from the .uk.co domain to the new .uk domain and I don’t think that is what you are trying to do.  I believe you want to keep your existing domain and just redirect the other domain to your existing domain.  Also just an FYI – in order to redirect a domain it needs to actually really exist somewhere – in a DNS record and at a physical location in some cases/scenarios.

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