使用RewriteRule缩短URL:完全删除内容根吗? [英] Shortening the URL with RewriteRule: Remove content root entirely?
问题描述
我试图缩短这样的网址:
I an trying to shorten an URL like this:
www.mystore.com/webapp/wcs/stores/servlet/CategoryDisplay?langId=-1& storeId=10001&catalogId=10001&categoryId=10006
...对此:
www.mystore.com/CategoryDisplay?langId=-1&storeId=10001&catalogId=10001& categoryId=10006
使用IBM的示例,只需在Apache配置中执行以下操作即可轻松摆脱大多数URL:
Using the examples from IBM I can easily get rid of most of the URL simply by doing this in the Apache configuration:
RewriteRule ^shop/(.*) /webapp/wcs/stores/servlet/$1
然后将其添加到wc-server.xml文件中:
And then adding this to the wc-server.xml file:
<context-root-rewrite value="/shop" />
是否有可能完全摆脱/shop/前缀?似乎Apache(aka IIS)中的任何功能都无法阻止这种情况,但是Websphere Commerce会对此感到窒息吗?
Is it possible to get rid of the /shop/ prefix entirely? It seems that nothing in Apache (aka IIS) prevents this, but will Websphere Commerce choke on it?
推荐答案
答案:因为在这种情况下,我们只是重新路由了对servlet的请求.如果还有其他内容,将会造成混乱.基本上,我们正在将一个子分支变为根的一个子分支,但是还有其他子分支.
Answer: Because in this case we are just rerouting the requests for the servlet. If there's any other content there will be confusion. We are basically moving a sub-branch to be a sub-branch of the root, but there are other sub-branches.
这篇关于使用RewriteRule缩短URL:完全删除内容根吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!