4

I had to move my image folder. Before it was example.com/shoplogo/(name*).png now its example.com/shop-logo/(name*).png just stuck with the rewrite rule :-(.

3

Presumably the visible links to your images remain the same and point to the old location: shoplogo and you need to internally rewrite the request to the correct location (ie. shop-logo) so that they still work.

Then you can do something like the following using mod_rewrite at the top of your .htaccess file in the root of your site:

RewriteEngine On
RewriteRule ^shoplogo/([^/]+\.png)$ /shop-logo/$1 [L]

$1 is a backreference to the captured filename.

  • thanks that worked, almost had it but stupid me... THANKS – joloshop Oct 21 '18 at 17:22
  • 1
    You're welcome - glad it worked. In the future, if you include the code you have tried in your question then we can maybe just correct and explain why the original code didn't work. As with many things (in .htaccess), there are many ways to write essentially the same thing. – MrWhite Oct 21 '18 at 17:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.