我已经设置了我的 .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
最佳答案
在 /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
关于.htaccess - 没有遵循重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30473543/