skip to Main Content

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?

3

Answers


  1. Chosen as BEST ANSWER

    Had to remove the image from wordpress before it would allow the redirect to work. WP rules seem to have got in the way. The .htaccess rule I originally created then kicked in.

    I tried the above comments prior to the deletion and they did not work. Cheers for your help both.


  2. 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.

    Login or Signup to reply.
  3. 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]
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search