htaccess的动态IMAGEURL重写重写、动态、htaccess、IMAGEURL

2023-09-02 00:53:26 作者:噢,特慢~

我要重定向我的所有的产品图片使用htaccess的外部站点。 不过,我无法弄清楚如何使用动态变量,图像的URL看起来是这样的:

I want to redirect all my product images to an external site using htaccess. However I cant figure out how to use dynamic variables, the image-url looks like this:

httpz://localhost/oc1505/image/80x80-10035.jpg

httpz://localhost/oc1505/image/80x80-10035.jpg

其中80×80是高度和宽度,以及10035.jpg是链接到外部图像。 因此,在这种情况下,我想将其重定向到URL,看起来像:

Where 80x80 is the height and the width, and the 10035.jpg is the link to the external image. So in this case I would like to redirect it to an url that looks like:

httpz://www.othersite.nl/imgs/prd/ 九龙 /10035.jpg

httpz://www.othersite.nl/imgs/prd/kln/10035.jpg

怎么过,如果源图像150x150-10035.jpg它应该重定向到。

how ever if the source image is 150x150-10035.jpg it should redirect to.

httpz://www.othersite.nl/imgs/prd/ STD /10035.jpg

httpz://www.othersite.nl/imgs/prd/std/10035.jpg

和我有一些其他的格式,我想重定向。

And I have a few other formats that I would like to redirect.

如果有人可以帮助我一点,我会很高兴。

If someone could help me out a little I would be very happy.

推荐答案

试试这个:

RewriteEngine on
RewriteRule 80X80-(.*)$ https://www.othersite.nl/imgs/prd/kln/$1
RewriteRule 150x150-(.*)$ https://www.othersite.nl/imgs/prd/std/$1