基于永久id的Web HTTP/HTTPS超链接方案,有多少种实现方式?
背景:
假设我有一个托管在 http://www.example.com< 上的网站/a> 并且该网站有很多绝对内部链接。发生了一些事情,需要我将整个网站移至http://www.example.net< /a> 所有其他内容保持不变。
显然,我可以进行全局搜索并替换网站代码来解决此问题,但我想知道有多少种方法可以创建一个永久链接方案,无论我在哪个网站,都永远不会中断移动到,只要相对路径相同即可。
注意:将 example.com 和 example.net 替换为两个完全不同的网络托管公司的名称。它们仅用于不提供免费广告的通用名称。
问题
有多少种不同的方式来支持永久超链接,例如:
http://some-aribitrary-string.com/some/path/here/page.htm
这样:
- some-任意字符串代表一个唯一的字符串,永远不必更改
- some-任意字符串解析为 DNS 条目或者我的代码在任何给定时间托管的任何机器的 IP 地址,
- 如果我必须更改服务器,我只需在一处更新此信息(而不必执行全局字符串搜索和替换
- )要使用此方案,我不必访问 DNS 记录
Background:
Suppose I have a website that is hosted on http://www.example.com and the site has a lot of absolute internal links. Something happens that requires me to move the entire website to http://www.example.net with all other things remaining the same.
Obviously, I can do a global search and replace on the website code to fix this, but what I am wondering is how many ways can I create a permanent linking scheme that will never break regardless of what site I move to, as long as the relative paths are the same.
NOTE: replace example.com and example.net with the names of two totally different web-hosting companies. They were just used for generic names that do not provide free advertising.
Question:
How many different ways are there to support permanent hyperlinks such as:
http://some-aribitrary-string.com/some/path/here/page.htm
Such that:
- some-arbitrary-string represents a unique string that will never have to change
- some-arbitrary-string resolves to the DNS entry or IP address of whatever machine my code happens to be hosted on at any given time
- if and when I have to change servers, I only have to update this information in one place (instead of having to do global string search and replace)
- in order to use this scheme I do not have to have access to DNS records
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
重写应该足够了:
您还可以使用
[P]
或[R=301]
通过内部代理路由请求或正确重定向它们。A Rewrite should be enough:
You could additionally use
[P]
or[R=301]
to route requests through an internal proxy or properly redirect them.