【问题标题】:How do I add .gif to pathnames in Apache httpd?如何将 .gif 添加到 Apache httpd 中的路径名?
【发布时间】:2012-10-21 05:16:48
【问题描述】:

对于专家来说,这是一个简单的 htaccess 问题,但我一直试图对此进行排序。这是开发人员在我使用此代码之前所做的事情。他从请求中截断了图像文件扩展名。例如,

/images/btn/Find a bear 应该将 URL 内部更改为 /images/btn/Find a bear.gif

文件夹中的所有图片都是.gif扩展名。

我尝试在根文件夹中重写此 URL,但没有帮助。

Options +FollowSymlinks
RewriteEngine On
RewriteRule ^images/(.*)$ images/$1.gif

我知道RewriteRule在服务器上开启了等等,请帮忙。

【问题讨论】:

    标签: apache mod-rewrite url-rewriting


    【解决方案1】:

    您可能遇到了无限循环。试试这个:

    RewriteCond $1 !.*\.gif$
    RewriteRule ^images/(.*)$ images/$1.gif
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-02-19
      • 2023-01-19
      • 2021-02-25
      • 2020-09-28
      • 1970-01-01
      • 1970-01-01
      • 2013-03-05
      • 1970-01-01
      相关资源
      最近更新 更多