Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

For a mature website I only need to generate a thumbnail once, using timthumb, which places the thumbnail in /thumbs/.

try_files $uri ^thumbs/(.*)$ /thumb.php?w=290&q=90&src=../full/%1 last;

How could I fix this code?

Working apache code:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/thumbs/(.*)$
RewriteRule ^(.*)$  /thumb.php?h=90&q=90&src=../full/%1 [NS,L]

Thanks in advance :)

share|improve this question

1 Answer 1

up vote 0 down vote accepted

I think you need to change %1 to $1 in the try_files directive.

share|improve this answer
    
Hm, I now have this. But het just says the configuration file test failed. pastebin.com/P1Yk7zP4 –  cobra91 Mar 27 '12 at 14:28
    
Right, the try_files directive can't actually do rewrites. I think you'd have to use try_files $uri /thumb.php?src=$uri;, and either modify thumb.php to accept an entire URL as the source, or add a rewrite directive under a location block for /thumb.php. –  mgorven Mar 27 '12 at 18:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.