与URL中mod_rewrite的空间 [英] mod_rewrite with spaces in the urls
本文介绍了与URL中mod_rewrite的空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要设置一些规则集以重定向其中有一个空间,它的URL。我试过这样:
I need to set up some RewriteRules to redirect a URL which has a space in it. I've tried this:
RewriteRule ^article/with%20spaces.html$ /article/without_spaces.html [R=301,L]
...但它不工作。在一个空间,而不是20%,将导致500内部服务器错误。如何添加一个空格?
... but it doesn't work. Putting in a space instead of %20 causes a 500 Internal Server Error. How do I add a space?
推荐答案
尝试把一个\\在你的空间面前逃走了。
Try putting a \ in front of your space to escape it.
RewriteRule ^article/with\ spaces.html$ /article/without_spaces.html [R=301,L]
这篇关于与URL中mod_rewrite的空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文