我需要设置一些 RewriteRules 来重定向包含空格的 URL。我试过这个:
RewriteRule ^article/with%20spaces.html$ /article/without_spaces.html [R=301,L]
...但它不起作用。输入空格而不是 %20 会导致 500 内部服务器错误。如何添加空格?
最佳答案
尝试在空格前面加上\来转义它。
RewriteRule ^article/with\ spaces.html$ /article/without_spaces.html [R=301,L]
关于apache - mod_rewrite url 中带有空格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/410811/