我已将.htaccess
文件设置为将某些媒体(图像)重定向到其他图像。但重定向没有发生(旧媒体仍可访问)。
我的.htaccess
文件重定向有什么问题?这不是由于网址中的空格等(没有)。有什么想法吗?
RewriteEngine On
RedirectMatch (?i)^/wp-content/uploads/2015/04/emailImg1.jpg http://www.website.com/wp-content/uploads/2015/05/emailImg11.png
RedirectMatch (?i)^/wp-content/uploads/2015/04/emailImg2.jpg http://www.website.com/wp-content/uploads/2015/05/emailImg21.png
RedirectMatch (?i)^/wp-content/uploads/2015/04/emailImg3.jpg http://www.website.com/wp-content/uploads/2015/05/emailImg31.png
RedirectMatch (?i)^/wp-content/uploads/2015/05/emailImg4.jpg http://www.website.com/wp-content/uploads/2015/05/emailImg41.png
RedirectMatch (?i)^/wp-content/uploads/2015/05/emailImg1.png http://www.website.com/wp-content/uploads/2015/05/emailImg11.png
RedirectMatch (?i)^/wp-content/uploads/2015/05/emailImg2.png http://www.website.com/wp-content/uploads/2015/05/emailImg21.png
RedirectMatch (?i)^/wp-content/uploads/2015/05/emailImg3.png http://www.website.com/wp-content/uploads/2015/05/emailImg31.png
RedirectMatch (?i)^/wp-content/uploads/2015/05/emailImg4.png http://www.website.com/wp-content/uploads/2015/05/emailImg41.png
... Wordpress rules below
答案 0 :(得分:0)
在/wp-content/uploads/.htaccess
:
RewriteEngine On
RewriteBase /wp-content/uploads/
RewriteRule ^2015/04/(emailImg1\.jpg)$ 2015/05/$1 [L,NC,R]
RewriteRule ^2015/04/(emailImg2\.jpg)$ 2015/05/$1 [L,NC,R]
# rest of the rules using same pattern