Home Code HTML redirect

HTML redirect

1937
0

This is a very common question in HTML land.

Redirects can be done a variety of ways, and Server Side 301 redirects are probably the best, but if you don’t have the ability to do 301s or you want to add client-side code for completeness then check out this code I found on Stack Overflow. It works very fast so I figured it is worth republishing in case I need it again in the future….

<!DOCTYPE HTML>
<html lang="en-US">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="refresh" content="1;url=http://example.com">
        <script type="text/javascript">
            window.location.href = "https://example.com"
        </script>
        <title>Page Redirection</title>
    </head>
    <body>
        <!-- Note: don't tell people to `click` the link, just tell them that it is a link. -->
        If you are not redirected automatically, follow the <a href='https://example.com'>link to example</a>
    </body>
</html>

I used this code during a quick setup for a project using the Kintera Blackbaud CMS. I imagine they offer server-side redirects…I didn’t bother looking as I was in a rush.
One important tip here: Make sure you have the correct website plugged in for example.com because once you add it to the HTML version of your content piece, it works so fast you won’t have time to edit it again once you apply it!

http://stackoverflow.com/questions/5411538/how-to-redirect-from-an-html-page

Previous articleFormat a date in Microsoft Access database
Next articlePaypall.com fake email

LEAVE A REPLY

Please enter your comment!
Please enter your name here