Problem with ranking a php file that should not rank

Hi,

I have a web page that is PHP. The content is different depending on the PHP variables passed to the webpage.

The problem is I have seen the page without any reference to any variables appearing in search engines which when clicked shows a page without any content because no variables are passed to the webpage!

I think I should use .htaccess to block access. How do I do this?

So to recap:
Say the page: www.site.com/page1?id=1 is htaccess redirected to www.site.com/pagenumber1.htm
The problem is the page www.site.com/page1.htm is indexed by search engines (because there is a .htaccess file converting .php pages to .htm and no variables are passed to this page)

Any ideas?

Matt.

You could probably handle it within the php script by checking if the variable is set, then act accordingly.

if(!isset($_GET['id'])) {}

You could then redirect:

header('location: whateverpage');
exit();

Or display something but include this in the head:

echo '<meta name="robots" content="noarchive, noindex"> ';

so you are saying ‘no-index’ the page if ‘isset’ is not valid. Right?

That would only no-index the page if there is no content on the page.

Matt.

It’s one option.
The other was the redirect, which may be better, in case a human lands on the empty page.
If a bot found it, there must be a link somewhere.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.