0

所以目前我有一个像这样的网址:

http://test.com/images/1/Villa-1_watermark.jpg&width=132&height=123

理想情况下,我希望在图像目录中有一个 .htaccess 文件,该文件从位于子目录中的所有图像中删除查询字符串(“&width=132&height=123”)。

我目前有:

Options +FollowSymlinks -MultiViews
RewriteEngine on

RewriteCond %{QUERY_STRING} ^width=([^&]+)&height=([^&]+)$ [NC]
RewriteRule . %{REQUEST_URI}? [L,R]

任何帮助,将不胜感激。

4

1 回答 1

1

Apache 无法识别&width=132&height=123为查询字符串,因为它没有前导?. 试试这个:

RewriteEngine on

RewriteRule (.*)&.* $1 [L]
于 2013-01-15T21:21:35.037 回答