mod rewrite - filtering REQUEST_FILENAME in mod_rewrite for RewriteCond -


First of all, a simple question. If this can not be done, I will post a question that seeks an alternative solution.

In short, there is no need to create a filtered file path to check the Rivet conductor.

For example, I want to use this URL: /images/photos/gallery/beach.jpg/unique-identifier.jpg/width:50;height:50 To check this file: images / __ resize / photo / gallery / center.jpg / unique-indentifiers JPG is present.

To make things even more complicated, if this image file can not be found, then I need to pass the full url for the rezzer script which creates a resized image and is finally complete Sends the redirect headers pointing to the URL.

Please ask if you need more details. I left something deliberately because English is not my first language and I thought it would be difficult to understand in more detail what I am trying to do :)

First of all, this rule will check whether the file name is in your specific format or not. Then check that a file exists (__- by adding the position and leaving the last part). If it does not exist, it will call resizer.php :

  rewrite% {REQUEST_URI} ^ images /(.*)/ width: [0 - 9] +; Height: [0- 9] + rewrite angle% {DOCUMENT_ROOT} / images / __re resize /% 1! -f Rewrite Rule (. *) Resizer.php   

There is no need to provide any parameters for the resizer script as it is in the original URL < Code> $ _ SERVER ['REQUEST_URI'] .

You have not explicitly mentioned, but I think if such a file exists then you want to send it to the user.

  rewrite% {REQUEST_URI} ^ Picture /(.*)/ Width: [0- 9] +; Height: [0-9] + rewrite angle% {DOCUMENT_ROOT} / images / __re resize /% 1 -f rewrite rule (. *) / Images / __re resize /% 1   < / Div> 

Comments