How to test Page Redirects

What is URL Redirection?

Page redirection, also called URL forwarding, is a technique to make a web page available under more than one URL address. When a web browser attempts to open a URL that has been redirected, a page with a different URL is opened.

With URL redirects, incoming links to an outdated URL can be sent to the correct location. These links might be from users who saved the links as bookmarks/favorites in their browsers.

Status Codes used for Redirection:

The following is a list of commonly used Hypertext Transfer Protocol (HTTP) response status codes related to Redirect.

3xx Redirection – This class of status code indicates the client (browser) must take additional action to complete the request.

301 Moved Permanently – This and all future requests should be directed to the given URI.

307 Temporary Redirect – In this case, the request should be repeated with another URI; however, future requests should still use the original URI.

308 Permanent Redirect – The request, and all future requests should be repeated using another URI.

What is .htaccess 301 Redirects for Moved Pages

When a website is updated or redesigned, or there is a change in the location of content, a 301 redirect to the new location is used. It ensures that users who have book marked those pages or search engines can still find the pages.

A file is created with a file named .htaccess in the directory containing websites files. If the file already exists then it is edited and below line is added to the bottom of the file:

redirect 301 /old-page.html http://www.servername.com/new-directory/new-file.html

In above line, actual file names are substituted for old-page.html and “new-file.html”, and server name is substituted for “www.servername.com”.

How can we automate redirect testing?

To automate redirect testing we can use a tool called Xenu.

What is Xenu?

Xenu’s Link Sleuth™ is a freeware program that is available for download at http://home.snafu.de/tilman/xenulink.html. It runs on all versions of windows. It is a site crawler and once you point it at a URL it will crawl around the site and will generate a report with its findings at the end.

What Xenu does?

  • Checks Web sites for broken links. Link verification is done on “normal” links, images, frames, plug-ins, backgrounds, local image maps, style sheets, scripts and java applets.
  • Detects and reports redirected URLs

How we can perform Redirect Testing using Xenu?

Here are the steps required to perform Redirect testing uisng Xenu:

  1. Copy the list of URLs that you want to test and paste the list in a notepad doc. Save this file using some meaningful name.linkstoverify
  2. Select Check URL List (Test)… from File Menu.FileMenu
  3. Open the file you created in step 1openlistofURL
  4. Xenu will generate a report for the list of link mentioned by you in step 1htmlreport
  5. Now we’ll export this report. Select option “Export Page Map to Tab separated File…” from File menu. A dialog will open giving you an option to save the file in .txt format or *.*
  6. Enter you file name followed by extension (.xls) and click Save button.Export
  7. Open the newly created excel sheet.This sheet will show you all original and redirected links. The status shows whether this redirection is done successfully or not.Results
  8. You can also generate an HTML report by selecting Report from File Menu.

 Reports Generated by Xenu

Two types of reports are generated by Xenu:

1.      Non-HTML Report in the Xenu Main Window

You can view the detailed results in the main Xenu window. The report shows the following details for each link:

  • Address – Full URL for current link.
  • Status – shows whether the link is OK, broken, skipped etc.
  • Type – MIME Type for current link.
  • Size
  • Title – shows Title for retrieved web pages, link text for skipped URLs.
  • Date – Date-Modified stamp of the file/URL.
  • Level – 0 for start page, 1 for URLs linked from start pages, 2 for URLs linked from that pages etc., depending on the number of levels allowed in Options dialog.
  • Links out – number of outgoing links on checked page.
  • Links in – number of inbound links on checked page.
  • Server – server software for internet URLs (empty for local URLs)
  • Error – error description.
  • Duration – the duration of retrieving process.
  • Charset – character encoding.

2.      HTML report

These reports are generated in HTML format and provide below information:

  • Broken links, ordered by link
  • Broken links, ordered by page
  • List of redirected URLs
  • List of valid URLs you can submit to a search engine
  • Site Map of HTML pages with a Title
  • Broken page-local links
  • Orphan files
  • Statistics for managers

You can also generate an HTML report by selecting Report from File Menu.

Article written by

Please comment with your real name using good manners.

Leave a Reply