Prevent Websites from Redirecting in Mozilla Firefox

Some sites are very aggressive about redirecting you to different pages or even different websites. One possible reason for them to do this advertising but some attack sites may also redirect you to phishing or malware infected websites. If you do not want to be redirected by websites, then you can make use of the NoRedirect add-on in Mozilla Firefox. This add-on prevents websites from using HTTP header to redirect you.

You can download and install the NoRedirect Firefox extension from the Mozilla Firefox add-ons website. On this Mozilla website, you have to click on the green colored Add to Firefox button. The extension installation requires you to restart your Firefox browser. After the restart, the first thing you should do is configure the NoRedirect add-on options. You can open these add-on options from the add-ons page which you can open by pressing the hotkey Ctrl + Shift + A. Alternatively, you can just press the hotkey Alt + P to open the NoRedirect preferences.

Prevent Websites from Redirecting in Mozilla Firefox

If you want to block the redirection to a webpage, then you have to enter the regular expressions pattern (RegExp Pattern) for the source or target webpage by clicking on the Add button. For example, if you want to block redirection to OpenDNS DNS error page, then you can enter ^http://guide.opendns.com/.*?url=. If you check the Source option then it would block redirection from the entered matching URL, otherwise it would block to a matching URL. If you want to allow redirection, then you can check the Allow option. The DNS Error option is used if you want to block redirection due to a DNS error.

Prevent Websites from Redirecting in Mozilla Firefox

That’s it. Now you will no longer be redirected based on the rules set by you in the NoRedirect options. For example, if you enter a non-existing domain name (for example, I used ghostsite.com.ag), then instead of DNS redirection you get the usual DNS error of Server not found as shown in the above picture.

You can download NoRedirect add-on for Firefox from https://addons.mozilla.org/en-US/firefox/addon/noredirect/.