.htaccess URL重定向不能与空间一起使用 [英] .htaccess URL redirect not working with space

查看:50
本文介绍了.htaccess URL重定向不能与空间一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

http://example.com/Richiesta%20Preventivo/index.html



.htaccess代码



.htaccess code

Redirect 301 /Richiesta%20Preventivo/index.html http://example.com/

Redirect 301 /Richiesta Preventivo/index.html http://example.com/

以上两个代码均无效。我们可以看到, Richiesta Preventivo 之间存在一个空格,这是造成问题的原因。第一个代码不起作用,第二个代码导致500个内部服务器错误。我想知道如何用空格重定向URL。

Above both the codes is not working. As we can see there is a space between Richiesta Preventivo which is creating the problem. The first code is not working and second one leads to 500 internal server error. I want to know how to redirect the URL with space.

推荐答案

%20 重定向指令,除非您对uri字符串加双引号,否则尝试

%20 is not allowed in a Redirect directive unless you double quote the uri string, try

Redirect 301 "/Richiesta%20Preventivo/index.html" http://example.com/

Redirect 301 "/Richiesta Preventivo/index.html" http://example.com/    

这篇关于.htaccess URL重定向不能与空间一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆