我的托管图像是链接在其他网站,所以现在我想重定向这些链接到我的网站。我的图像链接看起来像这个http://example.com/uploads/images/September2014//iphone-6.gif ( jpg、gif、png等所有图像类型),http://example.com/uploads/images/September2014//iphone-6.gif是动态文本,每个月(月名(字母表)年(数字))加上它末端的extra /。现在我要在url上面重定向到
http://example.com/media/iphone-6我试着跟随,但没有工作。
RewriteCond %{HTTP_REFERER} !example.com
RewriteRule ^\.jpg $1\.html [R=301,L我的网站htacess在使用anubhava回答后如下所示
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
RewriteCond %{HTTP_REFERER} !example\.com$
RewriteRule ^uploads/images/.+?/([^./]+)\.jpg$ /media/$1 [R=301,L,NC]发布于 2014-10-18 18:55:10
你的判断力似乎不对。可以将此规则作为first rule在根.htaccess中使用:
RewriteCond %{HTTP_REFERER} !example\.com$
RewriteRule ^uploads/images/.+?/([^./]+)\.jpg$ /media/$1.html [R=301,L,NC]https://stackoverflow.com/questions/26443209
复制相似问题