Forum Moderators: phranque

Message Too Old, No Replies

mod rewrite, doesn't work with my url

         

CodilX

10:16 am on Feb 12, 2010 (gmt 0)

10+ Year Member



hi there,

i'm using a php script that auto resizes my images, but the url for it is very long:

image.php/images/thumbs/[b]thumb1.jpg[/b]/?height=500&image=/images/thumbs/[b]thumb1.jpg[/b]


i'm trying to mask the url into smth like:

images/popup/[b]thumb1.jpg[/b]


so my .htaccess looks like this:

RewriteRule ^images/popup/[b]([^/\.]+)/?[/b]$ image.php/images/thumbs/[b]thumb1.jpg[/b]/?height=500&image=/images/thumbs/[b]thumb1.jpg[/b] [L]


..and it doesn't work..

can someone help me out with this? thanks!

jdMorgan

3:15 pm on Feb 12, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The RewriteRule pattern is incorrect and the substitution does not back-reference the requested images, so it can't work. Try:

RewriteRule ^images/popup/([^/\.]+\.jpg)$ image.php/images/thumbs/$1/?height=500&image=/images/thumbs/$1 [L]

You're not masking anything. You are replacing the long URL in the links on your pages with a short URL, and then rewriting that URL, when it is requested from you server by a client, so that it resolves to the correct script filepath plus query string needed to serve the requested image.

See the resources cited in our Apache Forum Charter for more information. The link is at the top left of this page.

Jim