faq
faq

Reputation: 3086

htaccess to redirect to a random link

How can i redirect a image link to other several random sources?

If for example http://www.example.com/logo.jpg to come from http://tinypic.com/something.jpg OR http://i.imgur.com/something.jpg

RewriteEngine On
RewriteRule ^http://www.example.com/logo.jpg$ http://tinypic.com/something.jpg ?? http://i.imgur.com/something.jpg [P,L]

Is this even possible?

Upvotes: 0

Views: 909

Answers (1)

gamag
gamag

Reputation: 423

It's impossible to randomly select an URL to redirect to in .htaccess.

You'll have to do the random selection using an other language like php. Redirect the request to an php file on the server, which either loads the random file from remote or sends a redirect header to the Browser.

Upvotes: 1

Related Questions