1

I have used timthumb to resize images from external site. I would like rewrite url to security my site But I don't know how to do it with .htaccess and php

(1) htp://mydomain.com/timthumb.php?src=htp://any-images.jpg&h=70&w=70&zc=1

(2) htp://mydomain.com/70/70/aHR0cDovL2ltYWdlc2hhY2suY29tL2EvaW1nOTEyLzE4NTgvZ3Z

I used php encode base64 htp://any-images.jpg to aHR0cDovL2ltYWdlc2hhY2suY29tL2EvaW1nOTEyLzE4NTgvZ3Z

Now the question is: How to do rewrite from (1) to (2)?

4
  • Would it make it easier for yourself if your url's had a clue as to what was in them? e.g.: http:/example.com/thumb/70/70/aHR0cD... instead of: http://example.com/70/70/aHR0cD...? Type of url e.g. 'thumb'. It will make the '.htaccess' rules easier and more reliable. Commented Dec 6, 2014 at 16:49
  • Ofcourse, anyway. But how to do it Ryan Vincent? Commented Dec 6, 2014 at 16:53
  • Sorry i misunderstood what you want to do, what is the full url that you want the user to see in the web browser for your image url? Commented Dec 6, 2014 at 16:56
  • On web brower user will see link (2) <img src="http:/example.com/70/70/aHR0cD..."> Commented Dec 6, 2014 at 16:58

1 Answer 1

1

If you have sysadmin privilege you could use RewriteMap to define a mapping process as per the documentation, However since you are already via a PHP script you could use a regexp of the form

 RewriteRule ^(\d+)/([A-Za-z0-9+/]*)$ timthumb.php?h=$1&base64=$  [QSA]

But you would need to modify timthumb.php to parse the base64 parameter and decode it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.