How do I redirect pages and websites to other pages and websites?

Sections

    Hosting panels create special entries in one of two files that tells the web server software or client browsers to redirect from one page to another.
    If you want to achieve this result, you may edit these special files and or add a new file to your site root to do this for you.

    To completely redirect your site to another URL.

    • The easiest way is to a new file to your website root and make sure this is the default (or first) page that gets loaded by your hosting provider.
      Normally this is called index.html.
      Create the new text file and add the following text to it.

    <html>
    <head>
    <meta HTTP-EQUIV=”Refresh” CONTENT=”0;URL=http://newsiteorpage.com”>
    </head>
    <body>
    </body>
    </html>

    If your site is now loaded it will see the meta tag and redirect the site to http://newsiteorpage.com. (Just replace this with your requirement.)

    • Alternatively you may edit the .htaccess file (Linux) or the web.config file (windows) and add a redirect request.
    • For Linux .htaccess add the following text to the file.Redirect /somedir/page1.htm http://newsiteorpage.com/somedir/page2.htm
    • For web.config please add a rewrite rule in the <system.webServer> tag.
    <system.webServer>
        <rules>
            <rule name="Rereoute" stopProcessing="true">
                <match url="/somedir/page1.htm" />
                <action type="Redirect" url="http://newsiteorpage.com/somedir/page2.htm" />
            </rule>
        </rules>
    </system.webServer>

    Related Articles

    in Web Hosting Tags: htacesshttp redirectWeb Config
    Did this article answer your question?