重写一个空的查询字符串 [英] Rewrite for an empty query string
本文介绍了重写一个空的查询字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要建一些缓存来我的网站之一,我似乎无法找到,如果有添加一个条件与mod_rewrite的应用仅当一个请求查询字符串是空的一种方式。
I'm building in some caching to one of my sites, and I can't seem to find if there's a way to add a condition with mod_rewrite to apply only if the query string on a request is empty.
例如,我很想知道,如果我能有一个不带查询字符串
For example, I'd love to know if I can have a request with no query string like
http://www.example.com/
在
http://www.example.com/index.home.html
但随着查询字符串的任何请求,如
But any request with a query string, such as
http://www.example.com/?id=32
正常加载,而不是由重写而受到影响。
to load normally and not be affected by the rewrite.
我是什么失踪?
推荐答案
我想通了。这似乎这样的伎俩pretty得好:
I figured it out. This seems to do the trick pretty well:
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^/$ /index.home.html
当然,如果有更好的办法,我很想听听吧。
Of course, if there's a better way, I'd love to hear it.
这篇关于重写一个空的查询字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文