Search code examples
htmlsubdomainshared-hosting

Junk characters in URL when domain forwarding


I'm facing this issue lately, I have forwarded my domain to one of the files which are hosted on my GoDaddy shared hosting. However, whenever I hit the domain name in the browser it leads to the respective file (.html ) along with the junk characters preceding.

Example:

www.domainname.info

Leads to:

https://www.mydomainname.in/coffee.html/NjSmZ/KiKgZ/

Result:

Error 404 page not found.

Haven't changed any code; it's a sudden behavior.


UPDATE (more info):

The NjSmZ/KiKgZ/ are the junk characters in the link. Forwarding is made through the GoDaddy domain forwarder itself. No external coding is done for forwarding.

www.Aitb.in is the domain which is been forwarded to advity.in/adarsha.html.


Solution

  • While I know not about how GoDaddy does its domain forwards internally, it does not seem to be a simple DNS CNAME as nothing shows on the current domain's lookup.

    While playing around, looking at the forwarded domain's response I see it delivers a 301 (moved permanently) http response. The response replaces the chosen domain with the new one, and keeps the path part of the URL intact.

    Considering domain.a is the forwarded domain and domain.b is the new domain, that means:

    http://domain.a/ => http://domain.b/
    http://domain.a/contact.html => http://domain.b/contact.html
    http://domain.a/a/long/path/ => http://domain.b/a/long/path/
    

    But in your case, you are forwarding to more than just a domain... domain.b is more like domain.b/coffee.html , following the same rule, this means:

    http://domain.a/ => http://domain.b/coffee.html
    http://domain.a/contact.html => http://domain.b/coffee.html/contact.html
    http://domain.a/a/long/path/ => http://domain.b/coffee.html/a/long/path/
    

    So, my suggestion here is, either use a better landing to url_rewrite the redirected paths to the correct one. Or, if you cannot you could try to add a ? or # at the end of your URL. This is pure speculation, but if the rewrite has no other hidden rules, this would give something like the following, which will make the appropriate request and "hide" the trash part.

    http://domain.a/ => http://domain.b/coffee.html?
    http://domain.a/contact.html => http://domain.b/coffee.html?/contact.html
    http://domain.a/a/long/path/ => http://domain.b/coffee.html?/a/long/path/