.htaccess - 没有遵循重定向

标签 .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

最佳答案

/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/

相关文章:

php - $_GET URL 来自 ?url=http ://google. com

Angular:为什么 http 调用在 ngOnInit 中起作用,而不是在点击事件中起作用? (与缓存有关)

javascript - 我可以创建一个同时适用于 HTTP 和 HTTPS 的 javascript 文件吗

php - .htaccess - 将 domain.pl/something 重定向到 domain.eu/something-else

java - 在测试 : Argument [RedirectAttributes] is of type Model or Map but is not assignable from the actual model. 你可能需要

Wordpress 子文件夹安装重定向到 root

wordpress - htaccess 密码保护干扰 Wordpress 功能

wordpress - 尝试使用 301 redirectmatch 重定向旧 URL 是最接近的新 URL

php - URL重写和URL重定向

Angular 5 Http POST请求转向OPTIONS并返回404