I'm trying to add watermark to images on my site. It worked for me on my local test PC, but on the hosting, they enforce
RewriteBase /
which seems to complicate things a bit.
.htaccess placed in /images/stories/virtuemart/product/ folder does work any more as expected, and I can not figure out the way to fix it.
Some of the latest version is:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^images/stories/virtuemart/product/(.*)\.(jpeg|jpg)$ /watermark/watermark.php [QSA,NC]
I also tried to put the same in the root .htaccess
Original version that works on my test server without Rewritebase / in the root:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule \.(gif|jpeg|jpg)$ ../../../watermark/watermark.php [QSA,NC]
I suspect that the issue might be with relating the URI to watermark.php, or maybe something needs to be changed in php receiving this request, e.g. this part:
$path = $_SERVER['DOCUMENT_ROOT'].$_SERVER['REQUEST_URI'];
preg_match('@\.(gif|jpg|jpeg|png)$@i',$_SERVER['REQUEST_URI'],$m);
$ext = strtolower($m[1]);
$generated = CACHE.md5($_SERVER['REQUEST_URI']);
or Rules should store some more parameters, like in:
RewriteCond %{REQUEST_URI} ...
Any help is greatly appreciated.