Home / User Guide / Run URL Tests
HEADMasterSEO is a bulk redirect checker that allows you to automatically test if your redirections are setup correctly. It can:
You don't need to examine where every URL redirection goes. HEADMasterSEO can automatically grade every URL redirection (PASS/FAIL) for correctness if you supply it with URL mapping rules.
You can immediately see which links are incorrectly redirected!
The concept is simple:
You write the URL mapping rules once and run the redirection tests as many times as needed to fix all redirection errors.
Here's how the process works:
Running A Redirection Test
Open the "Test URLs" menu > "Test URL Mappings" screen.
Set the input file with your test URLs and the text file with all mapping rules (see below) and start the test.
An input URL will get a PASS grade if:
Reasons for getting a FAIL grade:
Note: If you have an invalid SSL certificate on the staging server then configure HEADMasterSEO to ignore SSL errors (SSL/TLS configuration screen). If you don't set the option, the program will fail all URLs due to "SSL errors".
The mapping rules file tells HEADMasterSEO where an input URL should redirect to.
It is a simple plain text file. Comments start with the ; symbol. General format is:
mapFromURL mapToURL
Redirect Rules Format
There are 3 formats for specifying redirection rules:
Sample mapping rules file:
; this is a comment
; simple plain mapping rule
http://olddomain.com http://newdomain.com
; simple {} rule
/blog/{} /blogs/{1}
; reg expression rule
(/forum/([a-zA-Z0-9]+)/(.+)) http://discussions.newdomain.com/{1}/{2}
The plain URL rule
The simplest rule format is: sourceURL destinationURL
. You can use full urls like: http://www.domain.com/path
or you can use relative paths such as /blog
.
Once you use a full url, you can then use relative paths (always starting with /) in the following rules. Use another full URL to change the source or destination domain.
You can use full/relative paths for both the source (mapFrom) and destination (mapTo) URLs.
Example:
;redirect old domain to new one
http://www.olddomain.com http://newdomain.com
; use relative paths now
/about /about-us
/contact /contact
; change the destination domain to a subdomain
/forum http://forums.newdomain.com
; change back the destination domain
/support http://newdomain.com/support
In this example, the 4th line tells HEADMasterSEO that http://www.olddomain.com/about should redirect to http://newdomain.com/about-us
The simple {} rule
The mapFrom (first URL in a pair) can contain {}. These {} will match any character until the program finds the character after the {} or the URL ends.
Example: /blog/{}/
will match /blog/hello/
and /blog/category/
, but it will not match /blog/just-this
or /blog/category/post/
The mapTo (the 2nd URL in a pair) can contain {1}, {2} etc. and these will be replaced by the matched text from the input URL {}.
Example rule:
/blog/{}/{} /blog/{2}
If your input link is /blog/category/blog-title
, the program will check if it redirects to /blog/blog-title
Here we effectively remove the category from the input links.
Important
Every input link is matched to just one mapping rule. If a link can be matched to more than 1 rule, HEADMasterSEO picks the 1st rule in the file as the correct rule.
The input link: /forum/subforum/forum-post can match both these rules
/forum/{} /dest1
/forum/{}/{} /dest2
If both rules are in the mapping rules file, HEADMasterSEO will match the input to the 1st rule in the file (/forum/{} /dest1
).
The regular expression mapping rule
Regular expression rules always enclose the mapFrom URL in () brackets. The 2nd URL is rewritten again using {1}{2}... matches from the input URL. The {1} corresponds to the 2nd matching group, {2} to the 3rd etc.
Example:
(/forum/([a-zA-Z0-9]+)/(.+)) http://discussions.newdomain.com/{1}/{2}
If the input URL is /forum/headmasterseo/help
, HEADMasterSEO will test if it redirects to http://discussions.newdomain.com/headmasterseo/help
Here {1} will be equal to "headmasterseo" and {2} will be equal to "help".
NOTE: use regular expression rules only with relative paths. Domain matching is not supported!
How to ignore parts of the destination URLs?
Sometimes you need to ignore parts of the destination URLs. An example would the server adding session IDs.
To make the URL testing work, you need to tell HEADMasterSEO to ignore the session IDs in the destination URLs or all tests with fail with "Bad final URL" error.
You do that by using the {} syntax in the destination URL. The {} will ignore one or more characters until the program finds the character after the {} or the URL ends.
Example: let's say the server adds a sid parameter at the end of the URLs such as: http://yourserver.com/page-url?sid=somevalue
The following rule would ignore the sid parameter:
\page-url \page-url?sid{}
You can mix the {number} replacements and the {} "ignore parts in the destination URLs":/blog/{}/{} /blog/{2}?sid{}
If you need help writing your mapping rules file or need consulting on a website migration, then contact us.