Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redirect one image to webpage Issue

I hope everyone is well.

I am having a few issues trying to redirect an image that was linked in error from an email to a html page.

For example the email points here - https://www.caravanguard.co.uk/news/wp-content/uploads/2021/03/Swift-Vogue-580-1.jpeg

But should point here - https://www.caravanguard.co.uk/news/make-mine-a-dealer-special-caravan-25644/

I have appplied the following to our .htaccess, but it does not appear to have worked. I have also done the same in the wordpress yoast plugin we use.

redirect 301 /news/wp-content/uploads/2021/03/Swift-Vogue-580-1.jpeg /news/make-mine-a-dealer-special-caravan-25644/

Any ideas?

like image 386
Tim Holmes Avatar asked Jan 23 '26 05:01

Tim Holmes


2 Answers

With your shown samples, could you please try following. Please make sure to place these rules at top of your .htaccess file. Also please do clear your browser cache before testing any URLs.

RewriteEngine ON
RewriteRule ^news/wp-content/uploads/2021/03/Swift-Vogue-580-1\.jpeg/?$ /news/make-mine-a-dealer-special-caravan-25644/ [R=301,NC,L]
like image 190
RavinderSingh13 Avatar answered Jan 25 '26 23:01

RavinderSingh13


You can use a RewriteRule

RewriteEngine on
RewriteCond %{REQUEST_URI} ^/news/wp-content/uploads/2021/03/Swift-Vogue-580-1.jpeg$
RewriteRule ^.+$ /news/make-mine-a-dealer-special-caravan-25644/ [R=301]

Make sure this rule is at the top of your htaccess or before your WordPress rules.

like image 21
Amit Verma Avatar answered Jan 25 '26 23:01

Amit Verma



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!