Hi im trying to do redirect from .jpg file to specific URL address but it don\'t work. Can sb help me?
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI}
Try this :
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/(.*)\.jpg [NC]
RewriteRule ^up/(.*)\.jpg/?$ /file?name=$1.jpg [R=301,L]
RewriteCond
is totally redundant here, you can match this pattern in RewriteRule
itself. Try this rule:
RewriteEngine On
RewriteBase /
RewriteRule ^up/(.+?\.jpe?g)$ file?name=$1 [NC,QSA,L]
Also you may not need R=301
here since you don't want to expose your internal handling of image to clients.