0

I'm using redirectMatch to get rid of TimThumb query string in thumb's link - Facebook API doesn't allow query string.

I'm using:

redirectMatch 301 ^/thumb/(.*)$ http://mydomain.com/thumbs/timthumb.php?$1

Apache is redirecting me from:

http://fotofly.lv/thumb/src=http://farm9.staticflickr.com/8250/8591752640_54300394_n.jpg&h=160&q=60&f=.jpg

to

http://fotofly.lv/thumbs/timthumb.php?src=http:/farm9.staticflickr.com/8250/8591752640_54300394ae_n.jpg&h=160&q=60&f=.jpg

There's missing / in http://

Tried rewriting links, had no success. How can I get that slash back in its place?

Armands L.
  • 1,885
  • 2
  • 14
  • 18
  • If the original URL you're using misses the slash, it is *perfectly normal* that the redirected URL also misses the slash. See the problem? – Alvin Wong Apr 19 '13 at 04:15
  • Sorry for that. Original URL has both slashes – Armands L. Apr 19 '13 at 04:36
  • I cannot confirm this behaviour with plain `RedirectMatch` and a simple echo PHP script. There must be a problem with either Wordpress or the PHP script. – Olaf Dietsche Apr 19 '13 at 06:24
  • _“Facebook API doesn't allow query string.”_ – that is nonsense. It’s more likely that _you_ effed things up by not properly URL-encoding parameter values. – CBroe Apr 19 '13 at 09:22
  • I came up with that after using goo.gl shortener and using that link instead of timthumb query string. Everything worked. Those thumbs works great with web, but not so great with CDN's. As far as I know, Facebook sharer has its CDN, which fetch thumbs from external sites. – Armands L. Apr 19 '13 at 20:27
  • @user2202789 There is no query string in the request, everything is part of the URI-path and normally Apache removes multiple slashes inside it. `mod_rewrite` could be used to get the URI-path directly from THE_REQUEST variable, but it contains this: `http://farm9.staticflickr.com...` which most probably will give a 403 error. One solution is to make the relevant URI-path segment a query string, adding a question mark before `src`. – Felipe Alameda A Apr 20 '13 at 04:18
  • I got it semi-working with `mod_rewrite`, it redirected to timthum.php, but it gave an error - invalid URL. I used `RewriteRule ^thumb/(.*)$ /thumbs/timthumb.php?$1 [L]`. Adding `?src` to RewriteRule isn't working - 404 error. – Armands L. Apr 20 '13 at 05:10

0 Answers0