Question

I have my images for every item stored in seperate folders, like this.

http://domain.com/upload/phones/2262/1.jpg

Now I want to redirect user using .htaccess if referrer is google to

http://domain.com/az/phones/item/2262/

Can anyony help me in this?

Was it helpful?

Solution

put this code in your DOCUMENT_ROOT/.htaccess file:

RewriteEngine On

RewriteCond %{HTTP_REFERER} google [NC] 
RewriteRule ^upload/([^/]+)/([0-9]+)/[^.]+\.jpe?g$ /az/$1/item/$2/ [L,NC,R]

Just keep in mind that HTTP_REFERER header can be manipulated.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top