• Ok this is what I’m trying to do : use timthumb.php with external images and remove the query string “?” after goggling a little i’ve found a way using .htaccess, here is my code:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^cdn-thumb/(.*)$ thumb/timthumb.php?$1 [L]
    </IfModule>

    basically this code replaces the part thumb/timthumb.php?src= with cdn-thumb/src= and it works fine if the image is hosted on my website and I point to it using the relative path ex : wp-content/uploads/123.jpg but when i try using it with a image hosted elsewhere (other domain) it breaks giving 404 error because it removes a slash from https://

    ex:
    https://my-domain.com/cdn-thumb/src=https://domain.com/123.jpg
    i get only
    https://my-domain.com/cdn-thumb/src=http:/domain.com/123.jpg

    so any clue how to fix this ? or alternative solutions ?

Viewing 5 replies - 1 through 5 (of 5 total)
  • I know nothing about this myself, but you might take a look at how Bulletproof Security deals specifically with Tim Thumb…and BPS has a Custom Code editor where you can add anything you wish and let BPS make it all work together.
    https://www.ads-software.com/plugins/search.php?q=BulletProof+Security

    Thread Starter ShokAIM

    (@shokaim)

    nope, doesn’t help at all

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    Can you post a more specific before and after, meaning complete URLs with query string?

    Thread Starter ShokAIM

    (@shokaim)

    i have the following url:
    https://my-domain.com/thumb/timthumb.php?src=https://other-domain.com/123.jpg

    and with .htaccess I try to achieve this:
    https://my-domain.com/cdn-thumb/src=https://other-domain.com/123.jpg
    and doesn’t work , i only get
    https://my-domain.com/cdn-thumb/src=http:/other-domain.com/123.jpg
    it strips one slash / from the external image url how can i make the .htaccess to leave that slash… ? or any other option to achieve a clean url without “?”

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    It’s the query string, that usually makes it all difficult…

    If you can get the cdn-thumb/src to work with a query string like then it may work. In this example I’m using ?imagepath

    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{QUERY_STRING} src(.*)$
    RewriteCond %{REQUEST_URI} !cdn-thumb
    RewriteRule (.*) https://my-domain.com/cdn-thumb/src?imagepath%1 [R=301,L]
    </IfModule>

    There should be a RewriteCond for ^thumb/timthumb.php too but I had trouble making that work.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘.htaccess & timthumb i need help’ is closed to new replies.