-1

can rewrite first rules ?

from

http://sitename.com/media/resizer/420x218/r/sitename.com/wp-content/uploads/2013/12/image.jpg

to

http://sitename.com/media/resizer/420x218/r/2013/12/image.jpg

by removing sitename.com/wp-content/uploads

this my current htaccess :

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /media/
RewriteRule ^resizer/(.*)x(.*)/r/(.*) resizer/resize.php?src=http://$3&h=$2&w=$1&zc=0&s=1
</IfModule>

i use this method : http://code.tutsplus.com/articles/using-timthumb-with-custom-urls-for-site-optimization--wp-23607

Mwordpress
  • 13
  • 1
  • 6

1 Answers1

0

Yes, of course you can. Since you don't include part of the source url in the url anymore, you'll have to add it yourself in the rewritten part.

RewriteRule ^resizer/(.*)x(.*)/r/(.*) resizer/resize.php?src=http://sitename.com/wp-content/uploads/$3&h=$2&w=$1&zc=0&s=1
Sumurai8
  • 20,333
  • 11
  • 66
  • 100
  • this need to edit src of image first to work thanks @Sumurai8 – Mwordpress Nov 02 '15 at 04:12
  • That's covered in the tag wiki of mod-rewrite: http://stackoverflow.com/tags/mod-rewrite/info . See [this question](http://stackoverflow.com/questions/11629896/mod-rewrite-redirect-url-with-query-string-to-pretty-url) for more details. – Sumurai8 Nov 02 '15 at 08:25