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 :-(.
1 Answer
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.
-
-
1You'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.– MrWhiteOct 21, 2018 at 17:29