Reputation: 23
I need to redirect image to make it look shorter
What I have
"http://site.com/images/screenshots/509cd93aad063.png"
What I need
"http://site.com/509cd93aad063.png" or even "http://site.com/509cd93aad063" if possible.
I've tried
RewriteRule ^(.png)$ images/screenshots/$1 [L] - No success =(
Upvotes: 0
Views: 513
Reputation: 4449
You need to add a wildcard .*
RewriteRule ^(.*\.png)$ images/screenshots/$1 [L]
Even better, you can exclude / from the wildcard:
RewriteRule ^/?([^/]*\.png)$ images/screenshots/$1 [L]
That way the rule applys only at the root path.
A Tip, you can debug Regular Expressions online: http://regexpal.com/
Upvotes: 1