Roots Discourse

Safe Redirect Manager


#1

Hi y’all

Apologies if this thread is really obvious (please delete if so)

I’ve just installed Root’s recommended plugin “Safe Redirect Manager” - but

  1. This is on a big site where I’m working with SEO guys so I can’t mess this up!
  2. 301 redirects are really “sticky” in the browser - so they’re a nightmare for testing!

So I really don’t want to trial&error this!

And I figure as it’s a Roots recommended plugin you guys could tag this thread as a tutorial!

My confusion it how under “Redirect from”
“This path should be relative to the root of this WordPress installation”

Yet on Redirect to
"This can be a URL or a path relative to the root of your website"

Obviously on Bedrock those two things are very different!

I’ve been given a spreadsheet with a long list of old page>new page mappings and I just need to insert all these.

Thanks in advance!


#2

You can use relative URLs like “/about/” without worrying about anything Bedrock related

There’s also WP-CLI support if you want to do a batch import


#3

Amazing Ben thanks as always!!

WP-CLI: unfortunately this is the last site I’m making on WAMP so no such luck - all my new development sites I’m using Vagrant which means Puphpet includes WP-CLI

The SEO guys were asking for another redirect plugin but I’m such a Roots Fanboi that I basically say to anyone “I work with all the Roots tools and if that’s not OK then it’s not OK that I work for you”


#4

If you have a long list of URLs and their destinations already set up for you, I would go with Nginx for the rewrites as it will be faster than PHP redirects which is what I assume that plugin will do for you.


https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/#taxing-rewrites

Then you can add them easily into Nginx with Trellis as well if you want

This method has always served me well and you don’t ever need to worry about the plugin getting deactivated and your rewrites going away.

But if your going to be doing it read up on both those Nginx pages above it will give you a better feel for what you are actually doing, why you are doing it, and the best way to accomplish it for your particular use case.


#5

Yeah… WP-CLI imports didn’t work (and were very confusing) for me on a recent project, and so I ended up using the Redirection plugin :frowning: That said it imported my 301 Redirect /.../ /.../file right away. I saw and they have some beta Nginx feature but I didn’t mess with it…


#6

Cheers guys! I love this forum for advice.

Re RiFi2k - I’m not on Trellis, I’m putting the site on Siteground managed WordPress hosting so it’s all Apache with .htaccess files. But it seems easier to do with a plugin - I hadn’t thought though about the redirects being at the PHP level. I suppose that will be slower but this won’t be getting like 100k hits a day or anything like that!


#7

I am using the same plugin that you roots guys suggested. (Safe Redirect Manager)

I had an old static php website domain.com/work.php that I would like to redirect to the new WordPress build with trellis/bedrock and sage domain.com/work/

is this the correct way to set the redirect from a php file to a wordpress page?

Thanks in advance!