Yoast and SiteMap Index XML: Difference between revisions
Created page with "Leaving SEO (Search Engine Optimization) up to one piece of software is not wise. Especially if it is Yoast. Now don't get me wrong, Yoast does a fairly good job at most thi..." |
mNo edit summary |
||
Line 7: | Line 7: | ||
So my suggestion would be to have a great big On / Off Button on the dashboard of their interface that says: "Advanced Interface: On / Off" which changes everything to smarten it up from its dumbed down display. | So my suggestion would be to have a great big On / Off Button on the dashboard of their interface that says: "Advanced Interface: On / Off" which changes everything to smarten it up from its dumbed down display. | ||
<br /> | == Taking Control of Yoast == | ||
The first thing to know is that Yoast "creates" an XML sitemap index named "sitemap_index.xml" in the root directory of a WordPress website it is installed on. "Create" is in quotes, because it doesn't create a file, but makes it so WordPress responds when a file by that name is requested (sort of like most other WordPress requests). In addition to the sitemap_index.xml file it generates / "creates" several XYZ-sitemap.xml files for pages, posts, images, etc. (depending on the website and configuration of Yoast). | |||
That leaves the door open for a bit of manipulation that allows full control of Yoast. | |||
=== How? === | |||
Whoever controls the Sitemap Index controls everything. IE, a new Sitemap Index can be manually created to point to all of the individual Yoast generated Sitemaps plus custom Sitemaps or ones generated by other SEO software. | |||
And that's fairly easy to do. Originally my thought was to use a simple Apache Rewrite directive in the site's .htaccess files (couldn't make it work inside of an Apache config file) as noted below to direct search engines to a different Sitemap Index;<syntaxhighlight lang="text"> | |||
<IfModule mod_rewrite.c> | |||
RewriteEngine On | |||
RewriteRule ^sitemap_index\.xml$ /SitemapIndex.xml [R=302,L] | |||
</IfModule> | |||
</syntaxhighlight>The above RewriteRule basically says: "Anyone that is looking for sitemap_index.xml should be redirected to SitemapIndex.xml and the browser should be given a 302 (temporarily moved) error number and that's it (the L at the end)." But it didn't work. Why? Because the sitemap_index.xml file doesn't exist. The WordPress software responds with the appropriate information when the file is requested, but that's after Apache can Rewrite something. Don't forget to make the SitemapIndex.xml file and then copy the raw Yoast XML markup code into the file as a starting point. | |||
Instead, just create the physical file sitemap_index.xml in the root directory of the WordPress website. My preferred solution was to use a hybrid of the two with a note inside of the sitemap_index.xml explaining what I had configured.<br /> |