Do I dare change the URL format in my Google sitemap?

[h=1]I currently use the following format in my sitemap:

[noparse]oil-testimonials.com/essential-oils/7638[/noparse]

But to help with SEO, I now use this format to get to the same testimonial:

[noparse]oil-testimonials.com/essential-oils/7638/say-goodbye-to-mosquitoes-while-4-wheeling[/noparse]

My sitemap uses PHP and is dynamic, so it would be very easy for me to change the code so the sitemap produces URLs with the new format. But google may see this as a whole new URL, and throw away the “link juice” that my URLs have built up in the last 8 years.

I use mod_rewrite in my .htaccess file so that people who attempt to visit the old URL format get redirected with a 301 to the new format. When that scenario happens, I also tell the landing page to use the canonical URL. However, if I change the format of the URLs in the sitemap, there really is no way to do a 301 redirect. Should I leave the old URL format in my sitemap or change it to the new format? Any suggestions would be greatly appreciated!
[/h]

The first URL - [noparse]http://www.oil-testimonials.com/essential-oils/7638[/noparse] currently redirects to the second URL - [noparse]http://www.oil-testimonials.com/essential-oils/7638/say-goodbye-to-mosquitoes-while-4-wheeling[/noparse] so Google already knows about both URLs and sees them as 1 rather than 2 separate ones.

I believe Google prefers to not have URLS in a sitemap that redirect, they prefer to have URLs that are not redirected.

I do not think there should be any issues with changing the format, but you never know until you test. Usually Google will give an error message in Webmaster Central if you have URLs in a sitemap that are redirecting. Have you received any of these error messages? If you have then you will need to change the format.

@busboy

My sitemap uses PHP and is dynamic…

While you are in the process of updating your URL’s why not dispense with the meaningless numeric reference completely and extract the URL keywords. Your internal search would then display the relevant page if an exact keyword match is found, present a list of near matches or a suggestion page?

Your original numeric search would still be valid but show the new SEO friendly canonical page.

John, I’m a bit confused by what you suggested. It’s bad to have a number in the URL that points the entry in the database? What I really need help with is knowing if I should change the format of the URLs in my sitemap when there is no way to do a 301 redirect. Thanks.

From your original post you mentioned that the:

OLD-URL:
oil-testimonials.com/essential-oils/7638

NEW-Canonical-URL:
oil-testimonials.com/essential-oils/7638/say-goodbye-to-mosquitoes-while-4-wheeling

I believe a Sitemap.xml is crawled and all new updates are added to the current crawler database. Their search engine database is then used to pick out exact or near matches to present a list of found items.

I noticed that in your sitemap.xml there is no reference to the NEW-Canonical-URL? I could be very wrong by assuming that it would be far better in your sitemap.xml to remove the OLD-URL and replace with the NEW-Canonical-URL.

The logic behind this is that any crawler going to your OLD-URL will be 301’d and update their database with your NEW-Canonical-URL. Also all OLD-URL’s (from any source) will be redirected by the .htaccess file.

@revium appears to agree
>>> I believe Google prefers to not have URLS in a sitemap that redirect,
>>> they prefer to have URLs that are not redirected.

<hr />

I do not know what “dynamic PHP software” you are using but it would help posters with future recommendations.

I also assume you have a database of posts with the following format:
table->id
table->title
table->blurb

If the above popular structure is similar to yours then I can give further information about how I have a PHP search function:

  1. if URL keyword has a number (within range of table->id) RESULT: table->title, table->blurb
  2. if URL has string then search table->title, exact match RESULT: table->title, table->blurb
  3. parse URL keywords and search table->title and table->blurb RESULT: all matched table->title
  4. RESULT: 404 page showing keywords not found and possible solutions.

Adapting the above function to your own specific requirements will cater for a numeric reference to a NEW-Canonical-URL.

<hr />

Nearly forgot.
>>> It’s bad to have a number in the URL that points the entry in the database?
As far as the crawler is concerned then the numeric is confusing and cannot be referenced.
Is your four digit number decimal, octal, hexadecimal or something else?