how to decline not direct urls

Submitted by alfaspace on Tue, 2007-10-16 10:18.

Hello,

I run the huge site with a lot of pages. The most pages have the direct URLs but some pages have a not direct an have & ? = signs in their paths. How to decline sitemap creation for this non direct URLs?

thank you
A.

Submitted by dmorison on Tue, 2007-10-16 10:27.

Hi,

You could make a simple modification to autositemap/autositemap.php to ignore URLs that contain a query string. In that file, look for the following code:

  $sql = "INSERT INTO ".$config_databaseTablePrefix."urls SET url='".mysql_escape_string($url)."'";
  mysql_query($sql,$link);

...and replace this with

  if (!strpos($url,"?"))
  {
    $sql = "INSERT INTO ".$config_databaseTablePrefix."urls SET url='".mysql_escape_string($url)."'";
    mysql_query($sql,$link);
  }

That should do the trick.

Cheers,
David.

Submitted by alfaspace on Fri, 2007-10-19 06:26.

Thank you for you quick and useful answer - it was useful. Now I have one small question:

How to decline url to my site with no preffics?
Explain: My primary domain is http://www.mysite.com, in some reasons AutoSitemap builds some url with http://mysite.com and Googe sitemap gives me the error that I try to submit not primary my domain.

I try to clean this nopreffics url manually direct via MyPhpAdmin, but it very difficult because my site is very huge :) and I always new links to deleted.

Thank You,
A.

Submitted by dmorison on Fri, 2007-10-19 07:05.

Hi,

Yes - that can be done quite easily. In the previous modification, you now have this line to decide whether to log or not:

  if (!strpos($url,"?"))

If you change this as follows, it will now do both tests:

  if ((!strpos($url,"?")) && (strpos($url,"http://www")===0))

That should do the trick...

Cheers,
David.

Submitted by alfaspace on Mon, 2007-10-22 06:43.

Thnak you David!

All working fine