WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Setting a redirection from old Blog to new Blog (5 posts)

  1. UsmanLaw
    Member
    Posted 8 years ago #

    Can I just put some code in the index file that will set up a redirection?

  2. Potter_System
    Member
    Posted 8 years ago #

    You can use the meta tag (inside head section) into a blank page, or change the .htaccess in your old host -if you're using Apache Web server

    Example of both:
    Meta tag:
    <meta http-equiv="Refresh" content="*time*;url=*your URL*/">

    .htaccess: (if you're using Apache as Web Server)
    RewriteCond %{HTTP_HOST} ^www.*your domain*.com$ [NC]
    RewriteRule ^(.*)$ http://www.*your new domain*.com/$1 [R=301,L]

    Example taken from mod rewrite cheat sheet

  3. billh
    Member
    Posted 8 years ago #

    Here's a short and sweet script that I've used in the past:
    <?php
    header('HTTP/1.1 301 Moved Permanently');
    header('Location: http://www.newdomain.com');
    exit;
    ?>

    Just save it as index.php to replace your old index file.

  4. Meta refresh doesn't work with all browsers and is a method to avoid if at all possible.

    As for .htaccess, rewrite keeps the old URL in the address bar I believe. Try:

    Redirect /oldblog/ http://www.newblog.com/

    You can also use PHP to do it:

    <?php
    header('HTTP/1.1 301 Moved Permanently');
    header('Location: http://www.newblog.com/
    );
    ?>`

  5. UsmanLaw
    Member
    Posted 8 years ago #

    Thanks guy I know have BlogIntroduction.com forwarding to BlogIntro.com

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.