Solved

What is the best way to redirect old Internet Explorer users to a new page?

Posted on 2013-12-09
18
504 Views
Last Modified: 2014-03-04
Hello,

I've been searching and not yet found a good solution that just works, quickly. In the past I've had a div that is hidden and if IE 8 or before it is set to be visible and covers the rest of the site beneath with a warning upgrade message.

I want a better solution where the user is just sent to a different page altogether.

I've tried loads of suggestions I've found online and none other than the one below have worked for me.

<!--[if lt IE 9]><meta http-equiv="refresh" content="0;URL=http://mysite.com/update.php"><![endif]-->

This one  does work, though it is slow, the page seems to render before this redirect occurs. So older IE users see the page kind of load but not look as it should, then redirect. I obviously don't want them seeing this, I just want the redirect to be instant.



Can anyone help me with the best way to achieve this please?

Thanks :)
0
Comment
Question by:igloobob
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 7
18 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 39705809
What about using mod_rewrite ?
Check the Browser Dependent Content section here :
https://httpd.apache.org/docs/trunk/rewrite/remapping.html

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} .*MSIE.*
RedirectMatch ^/$ update.php
DirectoryIndex index.php

Open in new window

0
 

Author Comment

by:igloobob
ID: 39705831
That looks great thanks. That goes into an .htaccess file then I take it? Also, this line

RewriteCond %{HTTP_USER_AGENT} .*MSIE.*

 looks like it is targeting all versions of IE, can I target specific versions? I want all below version 9 to redirect, 9 and above is fine to display the normal page.
0
 
LVL 82

Expert Comment

by:leakim971
ID: 39705846
.*MSIE.* is a regular expression

So this regular expression should workd for you : MSIE\s[5-8]\.

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} MSIE\s[5-8]\.
RedirectMatch ^/$ update.php
DirectoryIndex index.php

Open in new window

0
The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

 

Author Comment

by:igloobob
ID: 39705859
Hi leakim

thanks for the swift reply!

I've added that into an .htaccess file but it isn't working, the index.php page is loading?

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} MSIE\s[5-8]\.
RedirectMatch ^/$ update.php
DirectoryIndex index.php
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 39705891
This work fine for me :
<IfModule mod_rewrite.c>
RewriteEngine On
Options +FollowSymlinks -MultiViews

RewriteCond %{HTTP_USER_AGENT} ^.*(MSIE\s[5-8]\..*) [NC]
RewriteRule ^(.*)$ /update.php [L,R=302,NC]

</IfModule>

Open in new window

0
 

Author Comment

by:igloobob
ID: 39705895
hmm, I get this now (when viewing in Chrome),

[an error occurred while processing this directive]

and in IE (7) I get:

The requested URL /update.php was not found on this server.

The file is there. The whole site is in a development sub folder if that makes any difference?

mysite.com/dev/test/..all site files are here...
0
 
LVL 82

Expert Comment

by:leakim971
ID: 39705896
did you see my previous message?
0
 

Author Comment

by:igloobob
ID: 39705917
Hi, yes, it was after using what you posted in that last reply that I got the above happening
0
 

Author Comment

by:igloobob
ID: 39706267
Hi again Leakim, slight update, not sure what happened before but the page is loading correctly in Chrome / Firefox / IE 9+ etc

In the older IE versions (using IE tester) I am getting the webpage cannot be found message.
0
 
LVL 82

Expert Comment

by:leakim971
ID: 39706275
and the url is?
0
 

Author Comment

by:igloobob
ID: 39706281
Hi Leakim,

it's password protected as it's a development site. Can I send you the log in privately?
0
 
LVL 82

Expert Comment

by:leakim971
ID: 39706308
no, it's not allowed

the url used is : http://www.yourdomain.com/update.php

be sure to have update.php in the root folder
0
 

Author Comment

by:igloobob
ID: 39706329
Ah OK so this won't work until I move the site to the root then? I'll test it then when the site is ready to go live. Currently it's all in the sub dev folder.

The .htaccess file is on that dev folder with all the site files so would have thought it would still work.
0
 

Author Comment

by:igloobob
ID: 39706333
I probably need a few more days to a week to get the new site finished then will test this again in root and report back here.
0
 
LVL 82

Expert Comment

by:leakim971
ID: 39706334
for your test, provide the full path to the update.php folder FROM THE ROOT

/full/path/from/root/to/update.php
0
 

Author Comment

by:igloobob
ID: 39706340
OK great thanks I'll do that now..
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question