Forum Moderators: open

Message Too Old, No Replies

Home page indexed with 2 versions

how to remove index.php?id=1?

         

alahamdan

6:57 am on Jan 11, 2010 (gmt 0)

10+ Year Member



Hi

I'm using a tab view on my home page, the designer made it with a php code that create an id variable for each tab, i discovered it few hours after uploading the new design, and replaced it with html tab view that wont create an id variable.

few days before i discovered Google indexed my home page in 2 versions:

example.com/index.php and example.com/index.php?id=1

I know a solution will be to redirect index.php?id=1 to index.php with a 301.

But im on IIS6 windows server, no rewrite module available. there is any other solution?

Google didn't crawl the index.php?id=1 since 11-nov, but i want to make sure its removed. how?

Thanks ina dvance

marcel

8:16 am on Jan 11, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm not well versed in PHP at all, so I can't help you all too much, but the following is an option.

- Check for the query string when index.php loads
- If the value of id=1 then redirect to itself without the querystring.

here is example code to redirect

<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.example.com/" );
?>

Note: A better option is to redirect to the root (ie. without the index.php). But I'm pretty sure you would need some kind of rewrite tool for this, like ISAPI Rewrite

alahamdan

8:32 am on Jan 11, 2010 (gmt 0)

10+ Year Member



Hello Marcel, Thanks for reply

Since its only a one page problem (id=1 only Google bot saw it once before i fix it, and will never see it), so do you think placing this:

<link rel="canonical" href="http://www.example.com/" /> in the header of the home page will solve the problem and remove the id=1 version?, i mean better than using a code in the header to redirect the page.

marcel

9:22 am on Jan 11, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The rel="canonical" attribute is OK, but I use it only if there is no other option available to me, a 301 redirect is always preferable.

Does the index.php page ever get called with other querystring values? (ie. id=3, id=3 etc.) If so, the canonical attribute will give you more problems than it fixes.

alahamdan

10:06 am on Jan 11, 2010 (gmt 0)

10+ Year Member



Hi marcel

"index.php page ever get called with other querystring values? (ie. id=3, id=3 etc.)"

No its just a static page. that why i thought of <link rel="canonical" href="http://www.example.com/" />

I inserted the code in the head section of the page.