Parto
Parto

Reputation: 168

Htaccess - Redirect Google bot image to the right image URL

Google bot Image is accessing the wrong image URL, how can I redirect it to the right one:

Wrong URL:

https://website.com/assets/https://website.com/assets/shop/product.jpg

Right URL:

https://website.com/assets/shop/product.jpg

What I have tried:

RewriteRule ^assets/(.*)/assets/(.*)$ assets/$2  [R=301,L]
RewriteRule ^assets/https://website.com/assets/(.*)$ assets/$1 [R=301,L]
RewriteRule ^assets/([a-z:/.]+)/assets/(.*)$ assets/$2  [R=301,L]
RedirectMatch 301 ^/(.*)//(.*)$ http://website.com/$1/$2/

None of the above works

Upvotes: 0

Views: 43

Answers (1)

Abhishek Gurjar
Abhishek Gurjar

Reputation: 7476

Try with below,

RewriteEngine On
RewriteCond %{REQUEST_URI} website.com/assets/shop/product.jpg$ [NC]
RewriteRule ^ assets/shop/product.jpg [R,L]

Upvotes: 1

Related Questions