域转发时URL中的垃圾字符 [英] Junk characters in URL when domain forwarding

查看:120
本文介绍了域转发时URL中的垃圾字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近遇到此问题,我已将我的域转发到GoDaddy共享托管上托管的文件之一.但是,每当我在浏览器中点击域名时,它都会指向相应的文件(.html)以及前面的垃圾字符.

示例:

www.domainname.info

通往:

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

结果:

找不到错误404页面.

没有更改任何代码;这是突然的行为.


更新(更多信息):

NjSmZ/KiKgZ/是链接中的垃圾字符.通过GoDaddy域转发器本身进行转发.无需进行外部编码即可转发.

www.Aitb.in是已转发到advity.in/adarsha.html的域.

解决方案

虽然我不知道GoDaddy如何在内部进行域转发,但它似乎不是简单的DNS CNAME,因为当前域的查找中没有任何显示. /p>

一边玩一边看转发域的响应,我看到它提供了301(永久移动)的http响应.响应将选择的域替换为新域,并保持URL的路径部分完整.

考虑domain.a为转发域,domain.b为新域,这意味着:

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/

但是在您的情况下,您不仅要转发到域... domain.b更像domain.b/coffee.html,遵循相同的规则,这意味着:

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/

因此,我的建议是,要么使用更好的着陆方式url_redirect重定向的路径到正确的路径.或者,如果不能,则可以尝试添加?或网址末尾的#.这纯粹是猜测,但是如果重写没有其他隐藏规则,则将给出类似以下内容的内容,它将发出适当的请求并隐藏"垃圾部分.

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/

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.

解决方案

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/

这篇关于域转发时URL中的垃圾字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆