.htaccess重定向.jpg文件,其文件名中包含(.pl)

时间:2015-04-17 06:48:58

标签: .htaccess rewrite

这是我的网址mysite.com/screenshot/a/b/c/imgname.pl.jpg

每当我转到此网址时,它都会重定向到找不到。

<IfModule mod_rewrite.c>
RewriteEngine On
Options -Multiviews
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^screenshot/(.*)$ /screenshot/tempthumb.jpg [NC,L]

#it looks like htaccess is taking my url as a .pl perl file. 
#So This is what I have tried.

RewriteRule ^screenshot/(.*)(.)(pl.jpg)$ /screenshot/$1\.$3 [NC,L] 

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^page/(.*)$ ./page.php?permalink=$1 [L]
ErrorDocument 404 /404.php
ErrorDocument 403 /403.php
</IfModule>

<IfModule mod_deflate.c>
    <filesMatch "\.(js|css|html|php)$">
        SetOutputFilter DEFLATE
    </filesMatch>
    AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css text/javascript application/javascript
</IfModule>

可能是问题

1 个答案:

答案 0 :(得分:0)

我猜测问题是什么,它试图寻找一个名为pl.jpg的文件。尝试将其设为*.pl.jpg