Note that there are some explanatory texts on larger screens.

plurals
  1. POhtaccess: specific directory requests to forward to PHP file
    primarykey
    data
    text
    <p>So I am writing an on-the-fly thumbnail generator for a CMS and I am trying to find the best way to handle requests. Specifically, I need to come up with the apache code for an htaccess file that will take all requests to a thumbnail folder and send them to a thumbnail.php file instead.</p> <p>Ideally it would <em>only</em> forward you to thumbnail.php if the thumbnail doesn't exist, although checking for file existence within apache is beyond me.</p> <p>The request URL would look like this:</p> <p><a href="http://unknown_domain.com/unknown_folder/media/thumbnails/image-name.jpg?w=200&amp;h=100&amp;c=true" rel="nofollow">http://unknown_domain.com/unknown_folder/media/thumbnails/image-name.jpg?w=200&amp;h=100&amp;c=true</a></p> <p>And images would be stored in the thumbnails something like this (or could be the same URL as below if that makes more sense):</p> <p><a href="http://unknown_domain.com/unknown_folder/media/thumbnails/image-name-200-100-true.jpg" rel="nofollow">http://unknown_domain.com/unknown_folder/media/thumbnails/image-name-200-100-true.jpg</a></p> <p>Here is the closest I've come so far, I assume I put this htaccess in the thumbnails folder:</p> <pre><code>RewriteEngine on #RewriteBase /unknown_folder/media/thumbnails/ # optional, depends on your setup #Check for file existence here and forward if exists RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([a-z-])-([0-9]+)-([0-9]+)-true.jpg$ thumbnail.php?w=$2&amp;h=$2&amp;c=true [LQSE] </code></pre> <p>Thank you for any help provided in advance!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload