I am getting a weird error in Google Webmaster Tools when my site is accessed as
http://www.myurl.com/ it shows duplicate meta tags for a
http://www.myurl.com/?ref=wierdurl.com

I have no relation to this weird url, but obviously it is linked to my site this way and Google sees it as a separate page...and thus duplicate content.

What is the best way to handle this situation? I was thinking a PHP header call....but then I'm not sure whether I want to 301 all http://www.myurl.com/?whatever=whatever to http://www.myurl.com/ or should I just 404 these?

My concern with 301 is I can see potential for some weird hacks to be utilized this way again my site??? As unlikely as it is...I can see it happening...

The concern with 404 is potentially I am going to lose some links back to my site this way...

Is there a better way maybe or should I just go with 404? or am I being too cautious with the 301 hacking thing?

Nobody??? Anybody???

No one wants to help huh? I've decided that I'll be safe and go with a 404

A 404 isn't helping the user. If it were me, I would 301 it to a relevant file page or back to the index. 301's are safe as long as you don't change them around all the time. Remember... 301 means "permanent redirect." If you plan on changing it in the future, consider using a 302 redirect.

Correction - a 404 doesn't help the user if it just displays an error. You *can actually customize your 404 pages to give the end user some options on where to go from there. For example, "we're sorry but this page no longer exists. Please visit our homepage to search for the information you are seeking."

You basically want to make sure you either 301 the page OR customize the 404 message to give the user (and robots) options to move on.

Well, what I'm doing is redirecting the user to the index page but sending a 404 to the user/browser, so it's an invisible 404. Only bots can see it. (and I doubt any real user is going to come from this "hacker's" parked domain) The reason why I want to send this 404 is I want Google to know that this URL doesn't exist on my site...

you are going to make it invisible for visitors ? No problem will arrive if you do like that?

301 is the best for redirection.I will not suggest you 404.

Yes because the guy is employing a hacking technique...it leads to the same page it just he adds his URL at the end of my site, like this:
mysite.com?hissite.com
Which takes the user to the same page as
mysite.com
So I redirect the user to mysite.com and send an "invisible" php 404 header which tells bots, specifically google, that such a page does not exist...the user on the other hand sees nothing...
My concern with 301 is that it tells Google that such a page existed once on my site and now it has moved to a new location. I don't want google to think that his url existed on my site...I want Google to know that such a page never existed on my site...

From a usability aspect, pick the one that you have some flexibility to redirect visitors to a page you can convert them.

Sounds like you found your solution Serj. Good stuff :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.