8

I'm trying to use GoDaddy's 301 redirect, which is named as domain forwarding. I set up forwarding DomainA.example to DomainB.example as 301 "type".

I noticed DomainA.example is still indexed in Google after ~6 months, and it has a title in SERP of DomainB.example. When I click it on Google or visit in the browser, it redirects to DomainB.example, so everything is fine from UX perspective.

I've inspected DomainA.example with the http://www.webconfs.com/redirect-check.php tool and found out, that http://DomainA.example/ actually redirects to http://DomainA.example/MmSWZ/. And then this URL supposedly redirects to DomainB.example. What is that?

If I check again a few minutes later on the same tool, I see http://DomainA.example/ redirects to http://DomainA.example/MpppZ/, so it's a unique random middle-man URL every single time it seems!

I'm sure it's bad for SEO. How do I fix it?

3

2 Answers 2

1

I had this problem occur on several different domains controled by GoDaddy. I attempted several times to contact GoDaddy support to resolve the issue with no luck. Ultimately I decided to solve the problem myself because GoDaddy seems clueless to their problem.

Here is my solution: Add this PHP code to the top of your 404 error page. For WordPress, add this your theme's 404.php file:

<?php 
/* GoDaddy 404 Redirects FIX - by Daniel Chase - https://riseofweb.com */
$currURL = $_SERVER['REQUEST_URI'];
$CheckRedirectError1 = substr($currURL, -6);
$CheckRedirectError2 = substr($currURL, 0, 7);
$CheckRedirectError = false;
if (preg_match("/^[a-zA-Z]{5}\/$/",$CheckRedirectError1)){
    $CheckRedirectError = $CheckRedirectError1;
}else if (preg_match("/^\/[a-zA-Z]{5}\/$/",$CheckRedirectError2)){
    $CheckRedirectError = substr($CheckRedirectError2, 1);
}
if($CheckRedirectError){
    $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
    $redirectTo = str_replace($CheckRedirectError, '', $currURL);
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: " . $protocol . $_SERVER['HTTP_HOST'] . $redirectTo);
    exit();
}
?>

The script checks for the random characters and removes them, and then redirects to the proper page. You may need to add some exceptions or modify the script to fit your needs.

4
  • I fail to see how a PHP solution could resolve this? The GoDaddy redirect already gets to the correct destination eventually (without the spurious suffix) - which is what your code is trying to do. The "problem" is the variable middle-man redirect (still on the source domain) - which executes before your PHP code gets a chance to do anything!? (Aside: If you already have web hosting associated with the source domain, or can add this as an Addon domain to your current hosting, then there is no need to use GoDaddy's "domain forwarding" interface.)
    – MrWhite
    Commented Aug 22, 2018 at 12:14
  • @MrWhite in my testing the Godaddy redirects always add the suffix for bots and occasionally add it for real users. (Like 1 out of 20 times.) This code could help some. It seems more cumbersome than implementing the redirects yourself or finding a reliable redirect service though. Commented Aug 22, 2018 at 13:55
  • @StephenOstermiller Ah, there seems to be two separate (but related) issues here. #1 The scenario described in the question is a "normal" GoDaddy redirect. The 5-char suffix is only applied to an intermediary redirect. The suffix does not end up on the destination URL. The above PHP code will not do anything. #2 There appears to have been a "bug" (introduced last year cc. June 2017?) according to the threads you linked to above. The 5-char suffix is erroneously being passed through to the destination URL (not always at the end) and breaking the destination site. The PHP code is for #2.
    – MrWhite
    Commented Aug 22, 2018 at 14:53
  • Incidentally, the PHP code presented here is remarkably similar to the code at the end of the linked forum thread above: uk.godaddy.com/community/Managing-Domains/…
    – MrWhite
    Commented Aug 22, 2018 at 14:55
1

In order to do a 301 redirect, there needs to be a server at the specified location to reply to the browser's request for content with a location like:

HTTP/1.1 301 Moved Permanently
Location: http://domainb.example

This is necessary because the server has to reply to the browser over HTTP with a response. This kind of redirect cannot be done with DNS because that is not the purpose of DNS.

You might consider setting a CNAME record for DomainA.example with DomainB.example as the value. Your DNS zone might look something like:

NAME                    TYPE   VALUE
--------------------------------------------------
www.domaina.example.    CNAME  www.domainb.example.
www.domainb.example.    A      192.0.2.23

You would also have to ensure that any MX records (tells mail servers where to send email for a domain) for DomainA.example are updated to point to the host at DomainB.example so email can be routed accordingly (if necessary).

1
  • 1
    Godaddy runs servers that do nothing but redirect domains. They offer these redirects as a free service that you can choose after registering the domain. This answer doesn't really address why Godaddy's servers aren't working properly, but the information in this answer could be useful for setting up redirects somewhere that does work. Commented Oct 12, 2017 at 11:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.