I am a man who wears many hats at my day job, and one of my favorite hats is maintainer of our new Intranet site. I built the site on a WordPress foundation figuring any functionality I need could be added via plugin down the road. Recently ran into an issue with users accessing the site via an unsupported browser.
In the office I have designated the domain XXXX.LOCAL for anything that needs to resolve internally. Currently we purchase a piece of browser based software from a company that only supports IE in compatibility mode. This forces us to set XXXX.LOCAL to compatibility mode in all IE browsers. My WordPress intranet site does not like compatibility mode one bit. Since all my users have Edge, Firefox and some have Chrome as their available browsers the thought entered my mind to force them to use one of them.
HOW TO DESIGNATE iNTERNET EXPLORER AS AN UNSUPPORTED BROWSER
Step 1 – Turn on Apache mod_rewrite
Enter this command:
sudo a2enmod rewrite
This will activate the module or alert you that the module is already enabled. To put these changes into effect, restart Apache.
If you have WordPress installed the module will already be enabled
sudo systemctrl restart apache2 or sudo service apache2 restart
Step 2 – Edit the .htaccess file
This is an example of the WordPress .htaccess file
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On #-------ADDED TO DETECT IE BROWSER--------------- RewriteCond %{HTTP_USER_AGENT} "MSIE [1-9]" [NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /unsupported.html [R=301,L] #----------------------------------------------- RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress
As you can see in the above the section added looks for MSIE (Microsoft Internet Explorer) ver 1-9 and then redirects to an html file in the root of the web server http://xxxx.xxxx.local/unsupported.html
Other browser agents can be added as well.
Step 3 – Unsupported Landing Page unsupported.html
Generate a simple landing page for your visitors to help them understand what just happened.
EXAMPLE BELOW
ALERT! – UNSUPPORTED BROWSER DETECTED
You are currently attempting to access this site with an unsupported browser!
Google Chrome / Microsoft Edge / Fire Fox
Thank you for reading my blog,
-Joe