Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

.htaccess & Image Watermarking Question


Guest

Recommended Posts

Posted

I am using a simple php script and .htaccess file to watermark my product images however because I add images to the product descriptions using the FCK Editor then all images save in the /images/Image folder are also watermarked.

 

RewriteEngine 	on
RewriteRule	^(.*)\.jpg		/home/mydomain/public_html/images/image.php?%{REQUEST_FILENAME}
RewriteRule	^(.*)\.JPG		/home/mydomain/public_html/images/image.php?%{REQUEST_FILENAME}

 

Does anyone know of a RewriteRule to 'exclude' this subfolder so that the images that I add with the FCK Editor do not get watermarked???

 

Also while I am jibbering on about .htaccess files I also use these RewriteRules in the root .htaccess file

 

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://www.mydomain.co.uk/ [R=301,L]

 

Now yes it removes the 'index.php' from the url but it leaves a trailing slash i.e. http://www.mydomain.co.uk/

 

What needs changing to remove the trailing slash???

 

I have tried a couple of things but they just resulted in an Internal Server Error ;)

 

Thanks

 

Aran

Posted

Well I have googled for the RewriteRule until I am blue in the face and I can not see where/what to do do to exclude a sub folder. I could really do with squaring this off tonight so I dont have to edit 750 products tomorrow and change jpegs to gifs urgh

 

Aran

Posted

Are there any 'Apache' experts on today, if so your advise would be really welcome :)

 

Thanks

 

Aran

Posted

Not an apache expert.. but have read the doc on .htaccess

 

 

a .htaccess takes precedence depending on where in the folder structure it is...

 

so... a nested folder will inherit the htaccess rules of a higher level folder... unless you redefine them.

 

level1>level2>level3>level4

 

level1 .htaccess has a rule for image... it will affect level1, level2, level 3 and level 4

 

now if you go stick another rule in level 3 that affects the same thing as the rule in level1, the level 3 rule will take over for level3 and level4

 

basically you have to go into that pesky subfolder you want to exclude and rewrite the rule so that it does nothing to jpg files.

if there are folder below your pesky subfolder in which you do want the jpegs to be affected.. then

you will have to to into each of them and put the top level rule back in.

 

to recap.. a higher level .htaccess takes precedence over its own folder and lower level folders.

 

all the stacked .htaccess files in a folder stack have a cumulative effect, so you can add a rule or replace a rule in a subfolder by created an htaccess file in that subfolder (remember it affects and subordinate folder to that subfolder too.)

Posted

oops did not receive an email that there was a reply urgh

 

I have no idea where to start with the above suggestion lol

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...