How to Remove a Store Page from Customers Website


Joe Troyer: All right. So next up, second question here is how do I remove a store from my customer’s website and not tank the SEE? So this question comes from Mike G. So he says, basically I have a restaurant/bar client who has a store as part of their websites selling t-shirts, et cetera, and they no longer want the store. So questions, one, do I put a 301 Redirect on each of the store pages, redirecting them to a new page with the notice about the store closing? If yes, is there a quick way to install a 301 Redirect for a hundred plus pages with all the products? Or do I have to do each and every one of them manually? And then question number two, what’s the best way to handle this? I still think that’s question number two. Question number three, is it okay to remove content from the individual pages or can I just wipe it all at once, basically?

Joe Troyer: So what’s the best way to do this? All right. So I don’t know what your exact set up is, Michael, but you can do this through your HTACCESS file. So you can do this through your HTACCESS file. What I don’t know though is if you’re using WordPress. If you’re using WordPress, it gets a little easier. You don’t have to write so much code. You don’t have to be a coder. You may not even need to outsource it. But first and foremost, I’ll just put in my disclaimer here, I haven’t written a 301 redirect and an HTACCESS file in quite literally years. I’m going to show you a way that you can do it, but you need to test it yourself and make sure that it works for your situation. Considering, again, I haven’t written a regular expression code or anything in terms of an HTACCESS file in a long time.

Joe Troyer: So, to be frank, honest, I don’t remember how to code it with HTACCESS. If you’re using WordPress though, you could use a plugin like Yoast or Redirection. And if you’re using Yoast, Yoast has a little tab inside of it that will help you do redirects. But then there’s also a tab within there that you can write what they call a regular expression. And from there you can make it kind of dynamic. So if your store is sitting at, and then all the products are /store, /category, /name, and they’re kind of that URL structure, you can dynamically, with regular expression, you can write and one redirect and it will redirect each and every one of the URLs.

Joe Troyer: All right. So Michael’s on and Michael has Yoast. All right, fantastic brother. So please do your due diligence, back up the website first. Make sure that that you test this, you don’t just set it and forget it and walk away and not test this. Backup you website, as always, before you do anything risky. But I’ll show you how I would do this inside of Yoast. I’ll actually pull open the Digital Triggers blog and give you a quick little run through of how this works.

Joe Troyer: So I’m inside of Yoast, let me get this up on the screen. All right, so I’m inside of the Yoast plugin and then down at the bottom you just go to redirects and it’ll take you right here. So then from here we’re going to go to REGEX redirects. So again, test this, this is my disclaimer. Not saying it’ll work outside the box. It should, okay, it should work, but you’re, going to need to test it, obviously.

Joe Troyer: So what you’re going to do here is, let’s say that your URL is at /store, and let’s say that you want to redirect that to the homepage. We’re just going to put this in for the homepage. So then here what you’re going to want to do is you’re going to want to say, so anything that has /store/, and then this is where you write your little REGEX part. Basically you say anything that has a letter A through Z or a number zero through nine. Yeah, let’s see, look at that code. Yep, that looks good. Okay. Then you’re gonna wrap it like this. Boop, boop, boop. Is that right? Let me see.

Joe Troyer: No, so we need the bracket here first. So one second, one little edit there. Okay. This … And then I put a question or a query here. So this should work in theory, you might want to test it without the question mark, but this would make so that anything /store/ would automatically get redirected to the root. So you can change this to something else if you’d want. So that will remove anything. Then you just need to do one more redirect just on the store page, wherever you want to redirect that. So you’d redirect the store to the homepage, for example. So Michael Grab, that is it, brother. Test it out, but you should be good to go. It might be a little tweaked variation of that, but you got it there, man. Hopefully that helps you out.

CATEGORY: Ask Me Anything