php - Redirect internal to path, if resource doesn't exists -
i trying redirect internally location, user won't see "script" location / uri, if image not exists:
rewritecond %{request_uri} ^/resources/img/tires [nc] rewritecond %{request_filename} !-f rewriterule ^resources/img/tires/(.*)$ reifen/imagematch/$1 [l]
for example if request image:
http://domain.tld/resources/img/tires/manufacturer/image.jpg
-> image exists, directly serve image.
and if request:
http://domain.tld/resources/img/tires/manufacturerx/image2.jpg
-> image not exist, call script located @ http://domain.tld/reifen/imagematch/{manufacturerx/image2.jpg}
what have modify in rewrite rules, shown example work correctly?
best regards , thanks!
you can use rule in root .htaccess:
rewritecond %{request_filename} !-f rewriterule ^resources/img/tires/(.+)$ /reifen/imagematch/$1 [l,nc]
Comments
Post a Comment