我需要重写的链接:
http://www.example.com/uploads/lu/full/00bcde2d484f1dab979c19f14b2f38bfabf13496_152_152.jpg
我的规则
RewriteEngine on
RewriteBase /
RewriteRule ^(.*)_([0-9]+)_([0-9]+)\.(jpg|jpeg|png|gif)$ http://test.mywebsite.com/themes/publisher/vignettes/resize.php?src=$1.$4&h=$2&w=$3
输出网址
预期网址
http://www.example.com不在我的输出网址上,我不明白为什么
答案 0 :(得分:1)
您需要从始终包含完整路径的%{REQUEST_URI
中捕获值:
RewriteEngine on
RewriteCond %{REQUEST_URI} ^(.*)/([^/]*?)_([0-9]+)_([0-9]+)\.(jpe?g|png|gif)$ [NC]
RewriteRule ^ http://test.mywebsite.com/themes/publisher/vignettes/resize.php?src=http://%{HTTP_HOST}%1/%2.%5&h=%3&w=%4 [L,NE,R=302]