Odd htaccess rules- What is this? Do I need them?

I found today some odd things on my website’s htaccess while I was trying to ban an ip address.

But in order to understand what is the odd thing I have to tell you the story from the very beginning.
In order to migrate my website from WP to CP I had to downgrade to the WP version 4.9 instead of the 5.1 that it had been upgraded. And that because the migration plugin didn’t work on the v 5.1 at this particular point.
In order to do so I used one of backup snapshot of my website.

I did the migration successfully with only a minor update problem due to the lack of a library but all else worked perfectly fine.

So today while I was trying to ban an unwanted ip address I opened the htaccess file to edit it and I found nothing else but this. This is the htaccess of the current CP installation.

> # BEGIN WordPress
> # END WordPress

No problem with that, I can add whatever is missing.
So I went back to my backup in order to remember what else I had add to my htaccess ( not that many things either way. Just a couple of IPs).

And I found this in the htaccess of the last WP installation of 5.1 version 5.1

Yoast SEO - XML Sitemap Rewrite Fix
RewriteEngine On
RewriteBase /
RewriteRule ^sitemap_index.xml$ /index.php?sitemap=1 [L]
RewriteRule ^locations.kml$ /index.php?sitemap=wpseo_local_kml [L]
RewriteRule ^geo_sitemap.xml$ /index.php?sitemap=geo [L]
RewriteRule ^([^/]+?)-sitemap([0-9]+)?.xml$
/index.php?sitemap=$1&sitemap_n=$2 [L]
RewriteRule ^([a-z]+)?-?sitemap.xsl$ /index.php?xsl=$1 [L]
END Yoast SEO - XML Sitemap Rewrite Fix

Can someone explain to me what is this? Where did it come from? Why was automatically recorded in the WP htaccess ( I didn’t write it myself) and if is of course needed it in my current CP installation?

1 Like

Looks like it is from Yoast SEO, here is a link to their knowledge base:

1 Like

I run the Google XML Sitemaps plugin on my website.
Is this the same plugin with the Yoast one?
And if it is why my htaccess had nothing written to mention this Yoast thing before upgradting to the WP 5+ version ?

The first line of these rule thing says that it is a fix. A fix on a plugin that I didn’t run in the first place ( in case that is something different from the Google XML plugin) OR perhaps a plugin that was installed during the upgrade from WP 4.9 to the 5+ versions?

I’m asking because I don’t understand and I don’t know where I got this. I don’t know what is this and how it happen to be in the htaccess, why it wasn’t there, then it appeared there and now just it isn’t.!

Do I need it?

Interesting, did you have Yoast installed previously?

If it is just for Yoast and you uninstalled Yoast in favour of Google XML Sitemaps then I would say it isn’t necessary to keep.

1 Like

I’ve never had Yoast. In fact I don’t know what Yoast is.
I’ve always run from the very first time the Google XML maps plugin.
This one XML Sitemap Generator for Google – WordPress plugin | WordPress.org
that works just fine ( I wrote that on the other thread with the working plugins).

So… in order to understand. The Google plugin is not the same with the Yoast one? Is that so?

This is Yoast SEO: Yoast SEO – WordPress plugin | WordPress.org English (Canada)

So not the same, but I would be interested to hear from others who are more experienced here :slight_smile:

Is there any chance for these rules to be written there from CP as “just in case” rules for those who run Yoast?
I’m asking because I’m not sure which of the cms wrote this there.
I for one thing never run Yoast on my website, and as far I can recall the last time that I edited my htaccess it had only the Begin-End Wordpress thing and nothing else. That was some time ago and for sure on the WP 4+ versions.

The matter is that I can’t be sure about the version that wrote these rules because the server takes continuous automated snapshots of my website and stores only those that are from the previous month, the previous week and the previous day. In order to downgrade the website for using the migration CP plugin I used the previous week’s snapshot and whatever changes were made during the migration were made from this snapshot. This snapshot had nothing written in the htaccess.

The last snapshot that was made on WP - whidch was a snapshot made after I upgraded to the WP 5.1 - had these rules on the htaccess.

My concern is that WP installed Yoast of set the rules for those who use Yoast in the htaccess files without anyone’s consent .

No. Those redirect rules are for the Yoast sitemap and would only be written there if Yoast was installed at some point (even if you’re not using it now). Yoast is the only plugin that writes those particular rules. To clarify: Yoast is a SEO plugin…not a sitemap plugin… the sitemaps are just an extra feature. Note that your own site is the only one that benefits from these rewrite rules, so, it’s not something nefarious going on. These rules actually produce a sitemap of your sitemaps :exploding_head: like this. Click through a few links and you’ll see what I mean.

I tested a couple of these URLs on your domain and they lead to 404 errors, so, the rules should be disabled. You can either remove them, or add a # to the beginning of each line to disable it.

1 Like

I never had this plugin. And these rules are not at the current htaccess. I don’t know how it happen to be in the WP backup htaccess.

So to summarize the case. ( and correct me if I’m wrong)
1/These rules are not “just in case rules” from CP.
2/These rules have nothing to do with Google Site maps plugin.
3/These rules are not needed in my CP current htaccess file.
4/ And it seems that these rules came from outer space at some point with the WP 5+ upgrade…( if that information makes any sense or is needed to anyone who is more knowledgable than me on such matters).

Thank you all for your help. :slight_smile: :heart:

1 Like
  1. No.
  2. No.
  3. No.
  4. No, as previously mentioned, they came from the Yoast plugin (which shows only as SEO in the admin menu). At some point, it was installed and activated.
2 Likes

I never installed it. I am 100% sure about that.
I didn’t have an XML map plugin and a friend of mine who is a web designer advised me to use one. We were together when he showed me which plugin to use and how to install and set it up. That happened five years ago and I never installed any other xml plugin and not for sure Yoast that I didn’t know up until now its existence!

What do you mean with the admin menu? There is no such thing because there is no cpanel. I have direct access to the server via a terminal.

The ClassicPress admin panel located at yoursite.com/wp-admin/

image
This is Yoast.

…anyway, just don’t add the rules to your new .htaccess file and problem solved.

1 Like

No there is not such a thing. I’ve never installed Yoast.

Screenshot%20at%202019-04-07%2002-38-21

1 Like

I’m not sure what else you’re looking for. :slight_smile:

1 Like

I’m not looking for anything else. Thank you all for the information. You can mark that thread as solved.

The only thing though that I find odd is how I got these rules there. I’ve never installed Yoast I’m 101% sure about that and that is the reason why I keep on the discussion. How did these rules get there is a mystery for me. No one else other than me has access to my website so there is no chance that someone else installed this plugin and then removed it.

That is all. I’ll remove them of course.

1 Like

:slight_smile: Happy ClassicPressing!

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.