尝试缩短多个文件夹中的 90 多个网址
我有超过 90 个网址,格式如下:
http://www.mysite.com /folder1/folder2/page.html
每个 URL 都将打印在纸上,供用户输入到地址栏中。目前的问题是它们太长,因此我需要使这些 URL 尽可能短。
但是,这样做的最佳方法是什么?
子文件夹是否是最好的选择,例如“keyword.mysite.com”?
我不想使用网址缩短服务,因为它们仍然需要与我的域名相关。由于网址的数量,转发到页面的其他域名也是不可能的。
理查德
I have over 90 urls set out in the following format:
http://www.mysite.com/folder1/folder2/page.html
Each of these URLs will be printed on paper for a user to input into their address bar. The problem at the moment is they are too long and therefore I need make these URLs as short as possible.
However, what would be the best method for doing so?
Would sub folders be the best thing here, such as "keyword.mysite.com"?
I don't want to use a url shortening service as they still need to be related to my domain name. Additional domain names forwarding on to the pages are also out of the question due to the quantity of urls.
Richard
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在不知道您正在使用什么技术(apache/php、asp.net、JSP 等)的情况下,我只能建议研究网址重写。 这里是 ASP.Net 重写器的代码项目示例。
Without knowing what technology you are working with (apache/php, asp.net, JSP, etc) all I can suggest is investigating Url Rewriting. Here is a codeproject example of a rewriter for ASP.Net.
我很快就会想到一些机制。一种是为您自己的域托管您自己的网址缩短服务:http://docs .example.com/xsdf 等等。为您自己的用户编写一个应该不会是太多工作,特别是因为您甚至可以编写一个快速脚本来提交所有 URL 以进行缩短和替换,而无需为人类制作一个漂亮的界面。
如果您想要更便宜的东西,但服务器管理员需要做更多的工作,您可以在 Web 服务器中使用标准的“重写”服务:
Apache
mod_rewrite
指南nginx
HttpRewriteModule
。更新这些重写规则涉及编辑服务器配置文件,或删除新的配置文件。另一种机制将超出 Web 服务器本身的范围,因此长期维护可能会更容易或更困难,具体取决于您的团队将来更愿意使用哪种机制。
There's a handful of mechanisms that come to mind quickly. One is to host your own url-shortening service for your own domain: http://docs.example.com/xsdf and so forth. Writing one for your own users shouldn't be too much work, especially since you could even write a quick script to submit all the URLs for shortening and replace them all without ever making a pretty interface for a human.
If you want something even cheaper, but more work on the part of your server admins, you could use the standard 'rewriting' services in web servers:
Apache
mod_rewrite
guidenginx
HttpRewriteModule
.Updating these rewrite rules involves editing the server config files, or dropping new ones in place. The other mechanism would be outside the range of the web server itself, so it might be easier or harder for long-term maintenance depending upon which your team would rather work with in the future.