301 to new domain and server (2 posts)

  1. fredgorski
    Posted 4 years ago #

    Hi, I am trying to redirect an entire site to new domain and server. I am using the http://example.com/wp/sample-post or simply http://example.com/sample-post (both apply equally) structure. I added this to .htaccess
    here is the .htaccess rule

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    RewriteEngine on
    RewriteRule (.*) http://www.example.com.br/$1 [R=301,L]
    # END WordPress

    It works for both http://example.com/wp or example.com, but when it comes to /sample-post I get a 404 error message.

  2. President McCheese
    Posted 4 years ago #

    You could just do a php header redirect in index.php instead of mod rewrite -
    <?php header("Location: the-other-site.html") ?>

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.