.htaccess & timthumb i need help (6 posts)

  1. ShokAIM
    Posted 2 years ago #

    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]

    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 http://

    i get only

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

  2. leejosepho
    Posted 2 years ago #

    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.

  3. ShokAIM
    Posted 2 years ago #

    nope, doesn't help at all

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

  5. ShokAIM
    Posted 2 years ago #

    i have the following url:

    and with .htaccess I try to achieve this:
    and doesn't work , i only get
    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 "?"

  6. 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 (.*) http://my-domain.com/cdn-thumb/src?imagepath%1 [R=301,L]

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

Topic Closed

This topic has been closed to new replies.

About this Topic