通过htaccess重定向带空格的URL

问题描述 投票:0回答:1

我想重定向以下网址:/wp-content/uploads/images/TOWER/Dark%20Tower%20Official%20Art.html

我在htaccess文件中尝试了以下内容:RedirectMatch“/ wp-content / uploads / images / TOWER / Dark \ Tower \ Official \ Art.html”url [L,R = 301]

但它不起作用,因为它给了我500错误。知道怎么解决这个问题吗?

谢谢 !

.htaccess redirect url-redirection space
1个回答
0
投票

将每个%20更改为\ s(RegEx空白字符)

RewriteEngine On
RewriteRule ^wp\-content\/uploads\/images\/tower\/dark\stower\sofficial\sart\.html$ /new-link [R=301,NC,L]
© www.soinside.com 2019 - 2024. All rights reserved.