2.1 How to create custom SEO changes or "rules"

In this article:

  1. Introduction to SEO rules
  2. Robots.txt
  3. Canonicals
  4. Meta robots
  5. Titles
  6. Meta descriptions
  7. H1 tags
  8. Hreflang tags
  9. Error rules
  10. Redirect rules
  11. Media alternates

Introduction

RankSense has the ability to make the following types of SEO changes:

  • Robots.txt
  • Canonical tags
  • Meta robots tags (index, follow, noindex, nofollow)
  • Meta titles
  • Meta descriptions
  • h1 tags
  • Hreflang tags
  • 301 redirects
  • 404 error fixes (these are also 301 redirects, but we distinguish the two)
  • Media alternate tags (used when there is a separate mobile site)

Important: RankSense will overwrite the robots.txt, HTML meta tags, and existing 301 redirects, if they are present. This overwriting occurs on the Cloudflare layer, so the origin is unaffected.

We control these changes with a spreadsheet that we call a “rules sheet,” because they provide “rules” for our app. You can see a template sheet here:
Rules sheet template

You can make a copy of this sheet to fill in with your own SEO rules. The sheet does contain examples, so be sure to delete unwanted rules before publishing.

Each tab on the template controls a different type of SEO change listed above. For every tab except robots.txt, the URL that you want to change goes in the first column. The second column is typically the desired change, but in some cases, a third column is needed. The last column is an optional comment. I’ll explain the details of each tab below.

We allow wildcards in the rules, which can considerably reduce the number of rules you need to publish in certain circumstances.

This article only covers how to create the rules. For how to publish them, please see the article, “How to publish SEO solutions on RankSense.”

RankSense supports an advanced feature that allows you to track the impact of the SEO changes you make. For more on this feature, visit How to tag SEO changes to gain insights.

Robots.txt

This tab is used to publish a new robots.txt file or overwrite the existing one. It does not add to the existing robots.txt. Any line that is present on the current robots.txt must be transferred to the sheet or it will be removed when you publish.

Formatting:
The first column on the sheet should contain anything that comes before the colon on a normal robots.txt file. The second column should contain anything that comes after the colon. The colon and space will be added for you! See the template for an example.

Canonicals

This tab is used to add a canonical tag to a page. It will also overwrite the existing canonical tag, if present.

Formatting: In the first column, add the URL that the canonical tag will be applied to. In the second column, add the canonical URL (i.e. the URL that should be inside the canonical tag).

Meta robots

This tab is used to add index, follow, noindex and nofollow meta robots tags, or overwrite existing tags.

Formatting: In the first column, add the URL that the meta robots tag(s) should be applied to. In the second column, add the desired tag(s), separating with a comma and space if you use more than one tag. Please see the template for examples.

The tags here will overwrite all meta robots tags on the existing page. If the existing page has an “index” tag, and you wish to add a “follow” tag, you should include the text “index, follow” in the second column, not just “follow” (do not include quotation marks on the sheet).

Titles

This tab is used to add or overwrite meta titles.

Formatting: Place the URL in the first column, and the desired meta title in the second column.

Meta descriptions

This tab is used to add or overwrite meta descriptions.

Formatting: Place the URL in the first column, and the desired meta description in the second column.

h1 tags

This tab is used to modify an existing h1 on the page – the first one that appears in the HTML.

Formatting:
Place the URL of the page you wish to modify in the first column, and the desired h1 in the second column.

Hreflang tags

This tab is used to specify hreflang tags for sites that are available in more than one language or country (i.e. a US site and a UK site; or an English and Spanish site within the US).

Formatting:
Place the URL of the page you wish to modify in the first column. You will need to use the same URL on multiple lines in order to specify multiple hreflang tags.

In the second column, place the hreflang attribute. For example, “en” for English, “es” for Spanish, “en-us” for English users in the US, etc. You can also specify “x-default” for the default page. Do not enter quotation marks in this column.

In the third column, specify the URL for the language and/or country that you listed in the second column.

Errors

This tab adds 301 redirects to URLs that are currently 404 status. We differentiate these from “redirect” rules (see below) because the rule will automatically be deactivated in the URL becomes 200 status again at the origin.

Formatting: In the first column, place the 404 URL. In the second column, place the URL that it should redirect to. In the third column, place the status code to apply (typically 301).

Redirects

This tab adds 301 redirects, and is intended to be used for URLs that are currently 200 status. Remember that RankSense rules overwrite what is present on the site’s server, so if redirect rules are created for URLs that should be 200 status, it will create a problem on the site that can impact users as well as SEO.

Redirect rules cannot be used for sitewide redirects, i.e. all non-www URLs to redirect to their www equivalents. Sitewide redirects should be implemented on the server.

Formatting: In the first column, place the URL that should be redirected. In the second column, place the URL that it should redirect to. In the third column, place the status code to apply (typically 301 or 302).

Media_alternates

This tab adds alternate media tags for sites that have a separate mobile site, i.e. <link rel="alternate" media="handheld" href="https://m.example.com">. Please note that the mobile site will need to be set up separately and handled with a separate rules sheet from the desktop site.

Formatting:
The first column contains the URL you wish to modify. The second column contains the media attribute (i.e. “handheld”, but do not enter quotation marks on the sheet). The third column contains the URL to specify as the alternate.

To publish your SEO fixes, please see the article, “How to publish SEO solutions on RankSense.”

Go back to main page