开发者

Trying to shorten over 90 urls over several folders

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 possibl开发者_如何学Goe.

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


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.


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 guide

RewriteRule ^/xsdf$ folder1/folder2/page.html [R] 
RewriteRule ^/qwer$ folder2/folder3/page.html [R] 
RewriteRule ^/polz$ folder7/folder6/page.html [R] 

nginx HttpRewriteModule.

rewrite  ^/xsdf$ folder1/folder2/page.html redirect;
rewrite  ^/qwer$ folder2/folder3/page.html redirect;
rewrite  ^/polz$ folder7/folder6/page.html redirect;

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜