重定向不被跟踪

时间:2015-05-27 05:00:40

标签: .htaccess http redirect

我已将.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

1 个答案:

答案 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