• Apache

Blog Archives

apache rewriteRule removing the querystring in Apache < 2.4

apache rewriteRule removing the querystring in Apache < 2.4

Why?

eg: http://www.58share.com?query=jerry

301 redirect to: http://58share.com/jerry

在301跳转后会自动添加Query String到新跳转的地址: eg: http://58share.com/jerry?query=jerry

How?

1. apache >= 2.4

apache2.4 已经添加了 [QSD]这样一个标志位来解决这个问题

2. apache < 2.4

解决方案: 在跳转规则中尾部添加 ‘?’ 用来标示该跳转不需要将Query String 添加进去

Reference

http://www.marceldoorn.nl/en/blog/2012/august/server/rewriterule-removing-querystring-apache-24