Mobile app version of vmapp.org
Login or Join
Sims2060225

: Friendly URL change and Google Webmaster Tools warnings I just migrated (with mod rewrite) from non-friendly URLs to a bit-more-friendly URLs: from site.com/post.php?id=5 to site.com/post/the-title-of-the-post/5.

@Sims2060225

Posted in: #GoogleSearchConsole #Seo #Url

I just migrated (with mod rewrite) from non-friendly URLs to a bit-more-friendly URLs: from site.com/post.php?id=5 to site.com/post/the-title-of-the-post/5.

This is my PHP redirect from old to new URL:

if(empty($_GET['friendly']) && empty($_POST)){
include('includes/basedatos.php');
include('includes/funciones.php');
$id = (int) mysql_real_escape_string($_GET['id']);
$post = mysql_fetch_array(mysql_query("SELECT id, titulo FROM post WHERE id = $id"));
$titulo = $post['titulo'];
if($titulo == ''){
header('HTTP/1.0 404 Not Found');
}
$ruta = '/post/'.urls_amigables(trim($titulo)).'/'.$id;
header ('HTTP/1.1 301 Moved Permanently'); /* please not this */
header("Location: $ruta");
exit();
}


The problem here is that even I set the headers to 301 Google is warning me of duplicated titles (and descriptions) and shows me both (old and new) URLs.

Question: is this a temporary stage? or I am not moving properly the my post URLs?

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Sims2060225

3 Comments

Sorted by latest first Latest Oldest Best

 

@Lengel546

If your requests to the old URLs are actually redirected with status 301 to the new URLs (check with Firebug or similar), Google will notice sooner or later and drop the old ones from the index.
The bot has probably indexed the new pages and not (yet) checked the old URLs that are already indexed.
Your headers look fine for me.

Note below: ideally, you should take care that all links on the page actually use the new URLs, not sure whether this is the case.

10% popularity Vote Up Vote Down


 

@Nimeshi995

The problem here is that even I set the headers to 301 Google is warning me of duplicated titles (and descriptions) and shows me both (old and new) URLs.


Use the Fetch as Google to see if there's any Crawl Errors for the new friendly URLs. If they're reachable, then it just might take some time for Google Webmaster Tools to update.

Some things you can do to prevent further crawling and indexing for the non-friendly URLs:


Disallow URLs with those parameters from being indexed in your robots.txt:

Disallow: /*?id=
Tell Google not to crawl URLs with those parameters - see the bottom of the following and select No URLs: Specify how Google should handle parameters
Also be sure to remove the non-friendly URLs from your sitemap and add the friendly URLs to it.


You can verify that Google has indexed the new friendly URLs by using this search operator:

site:domain.com/post/the-title-of-the-post/5

10% popularity Vote Up Vote Down


 

@Angie530

You have factors with database type sites like Drupal and Wordpress, etc. one is your post appears stand alone, tags, archives and categories and now after all these years this is a problem. I just posted a related question today as well. 301 these variations or find a way to remove these factors.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme