是否可以通过PHP或JS减小链接的大小(以文本形式)?减少链接(URL)大小
E.g.我可能有这样的链接:
http://www.example.com/index.html <- Redirects to the root
http://www.example.com/folder1/page.html?start=true <- Redirects to page.html
http://www.example.com/folder1/page.html?start=false <- Redirects to page.html?start=false
目的是要找出,如果链接可以缩短,仍然指向相同的位置。在这些示例中,前两个链接可以减少,因为第一个指向根,第二个链接的参数可以省略。
第三个链接就是这种情况,其中参数不能省略,这意味着它不能被减少得比删除http://
更多。
所以上面的链接会减少这样的:
Before: http://www.example.com/index.html
After: www.example.com
Before: http://www.example.com/folder1/page.html?start=true
After: www.example.com/folder1/page.html
Before: http://www.example.com/folder1/page.html?start=false
After: www.example.com/folder1/page.html?start=false
这是可以通过PHP或JS?
注:
www.example.com
是不是我自己或者通过URL访问外域。这些链接可能是未知的,我正在寻找像自动链接缩短器这样的东西,它可以通过获取URL而不需要其他任何东西。
其实我正在考虑像linkchecker这样的东西,它可以检查链接是否在自动修剪前后工作,如果没有,那么检查将在较少修剪的链接版本中再次完成。但是,这似乎有点小题大做......
是www.example.com您的网站(即它由您控制)还是www.example.com任何网站? – GeneSys
如果你有服务器访问,我建议.htaccess'RedirectRule'的 –
不,他们不是我的域名。上面的补充说明。 – Steeven