I would like to do a 301 redirect from an old website of mine to a new one and would like to know the coding that keeps this from showing up in Google? I'm using Wordpress and don't want my competition to be able to see the 301 redirect showing up when they type site:mydomain.com. Any help on this would be great.
Can't be done. A 301 redirect is, by definition, visible. That's the difference between a redirect and a rewrite. After the redirect has been running for a while, the old URL will drop out of the index.
Now, if you want Site A to show the content of Site B with nobody the wiser, that's a proxy. Whole nother question.
And if you want to show one thing to your competitor and an entirely different thing to a major search engine ... uh ... I think you've come to the wrong forum :(
Edit: A search engine will never show the Redirect response as such. It will show either the new URL or the old one.
I think I mean by typing in info:mydomain when looking for 301 redirects they all would show up unless they're blocked from showing up or removed from google's index. There is a code you would put in to block bots like majestic & ahrefs and from seeing your 301 redirects.
All I want is to keep the 301 redirect from showing up from certain bots and from google showing it in their index. Google knows I did the 301 redirect internally but my competition doesn't need to see it. I'm pretty sure there is a php code to make this happen. I'm not looking to cloak a website.
when a 301 redirect shows up in Google, what does it look like? i always thought google wouldn't index a requested url that got a 301 status code response. are you saying you want google to index the requested url(s) in spite of the 301 response?
I've got a vague notion you don't really mean 301 redirect at all; you're asking about an internal rewrite. A 301 means "If you ask for a particular URL, the user-agent will be told to ask for something else." No way to camouflage that. But the new URL-- whether in the flesh or in a search engine-- won't have a big red label saying "Formerly known as..."
I think I mean by typing in info:mydomain when looking for 301 redirects
Can you say this in different words? I'm not familiar with "info:" as a search element. Casual experimentation suggests that it gives you content of the "description" meta tag-- if there is one-- for the specified page. Which is interesting in its own right, because I had no idea you could do that, but I don't think it's what you meant.
If you type info:example.com/dir/filename.html and it happens to be a recently redirected page, you'll be shown the new URL-- with description, if any. (I am experimenting here on my own site. Beyond a certain age, it doesn't say anything about the requested URL, even if the redirect itself is still active in htaccess.) Well. That was all extremely fascinating, but probably had nothing to do with your question.
:: wandering off to investigate why google claims never to have heard of one particular URL ::