【问题标题】:.htaccess dynamic imageurl rewrite.htaccess 动态 imageurl 重写
【发布时间】:2011-09-18 15:38:09
【问题描述】:

我想使用 htaccess 将我的所有产品图片重定向到外部站点。 但是我不知道如何使用动态变量,图像 url 看起来像这样:

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

其中 80x80 是高度和宽度,10035.jpg 是指向外部图像的链接。 所以在这种情况下,我想将它重定向到一个看起来像这样的 url:

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

如果源图像是 150x150-10035.jpg 它应该重定向到。

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

我还有一些其他格式想要重定向。

如果有人能帮我一点忙,我会很高兴。

【问题讨论】:

    标签: image apache .htaccess dynamic redirect


    【解决方案1】:

    试试这个:

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

    【讨论】:

    • 像魅力一样工作,非常感谢!我把它弄得太复杂了。
    猜你喜欢
    • 2018-06-02
    • 2011-06-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多