![]() |
|
|
#1 (permalink) |
|
Registered User
Join Date: Feb 2004
Location: Essex, UK
Posts: 88
|
Creating a rewriteCond in .htaccess
I've a php script which creates thumbnail images, which is part of the CMS of my website. However, this also means I can't use it directly within vB or phpBB forums, as [img]script.php?image=xyz.jpg[/img] just doesn't work.
What I'd like to do is create a 'fake' file, eg, http://www.creapsoft.co.uk/thumbs/chrisjlocke/03012008/file.jpg which (via .htaccess) will be re-written as http://www.creapsoft.co.uk/protectedimage.php?image=chrisjlocke/file.jpg_03012008&cachedimage=true&width=200 Could it be done? Could someone give me some pointers please? |
|
|
|
|
|
#3 (permalink) |
|
Registered User
Join Date: Feb 2004
Location: Essex, UK
Posts: 88
|
Thanks!
I don't know much about regular expressions either, but I didn't know if you could simply split the URL up into 'lumps' (using the / as a delimiter) and then I could use $1, $2, etc in the rewriteCond. I might be talking out of my bottom though... |
|
|
|
|
|
#4 (permalink) |
|
Registered User
Join Date: Feb 2004
Location: Essex, UK
Posts: 88
|
So far I've got this, but the server doesn't appear to be catching it.
RewriteRule /thumbs/(.*)/(.*)\.jpg_(.*)\.jpg$ /protectedimage.php?image=$1/$2.jpg_$3&cachedimage=true&width=200 [R=301,L] I've had to tweak the URL slightly from my opening post. The URL I'm passing it is http://www.creapsoft.co.uk/thumbs/ch...g_07012008.jpg and it should be re-mapping it to http://www.creapsoft.co.uk/protected...true&width=200 I've downloaded RegexBuddy, which confirms it *should* work, but all I'm getting is a 404. Its not clear from the weblogs why though - just that the URL passed couldn't be found (rather than the rejigged URL being wrong). Last edited by Chris Locke; 10-01-2008 at 11:35 AM. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|