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 :-(.

up vote 3 down vote accepted

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 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 at 17:29

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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