.htaccess重定向,空格%20无法正常工作

时间:2017-10-22 08:40:46

标签: .htaccess redirect http-status-code-301

我有这样的链接:

http://www.expamle.com/folder1/folder2/folder%20/file.html

我想将301重定向到.htaccess:

http://www.expamle.com/folder1/folder2/folder/file.html

我试过了:

RewriteCond %{REQUEST_URI} ^\/folder1\/folder2\/folder\%20\/file\.html$
RewriteRule .* http://www.example.com/folder1/folder2/folder/file.html [R=301,L]

但我得到了:

Not Found

The requested URL /folder1/folder2/folder /file.html was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

我也试过这个

Redirect 301 /folder1/folder2/folder%20/Export1.htm http://www.example.com/folder1/folder2/folder/file.html

但得到了同样的错误。

我做错了什么?

1 个答案:

答案 0 :(得分:0)

解决方案是添加如下引号:

Redirect 301 "/folder1/folder2/folder /Export1.htm" http://www.example.com/folder1/folder2/folder/file.html
相关问题