Redirect all posts to new domain (but not JPG files)
-
I have moved all content from an old domain to a new one, and I’d like the old site to redirect to the new.
I already have a root-to-root redirect set up using this code in the theme’s index.php file:
‘<?php
header( ‘Location: https://www.bayridgeodyssey.com/’, true, 301);
?>’I’d like to redirect all of the posts to their corresponding post on the new site, i.e.:
https://www.bksouthie.com/2010/10/memories-of-borough-park/
…to…
https://www.bayridgeodyssey.com/2010/10/memories-of-borough-park/https://www.bksouthie.com/2012/01/seen-on-third-avenue-lowens/
…to…
https://www.bayridgeodyssey.com/2012/01/seen-on-third-avenue-lowens/I would assume that there is some similar code I can add to single.php, but I don’t know.
There are about 550 posts – I’d like to avoid doing something manual that lists each one, but it is possible.
Also, I want to make sure references to files (like JPG or PNG images) do not get redirected (I didn’t transfer any of the old pictures).
Any ideas?
- The topic ‘Redirect all posts to new domain (but not JPG files)’ is closed to new replies.