• Hi, I am trying to redirect an entire site to new domain and server. I am using the https://example.com/wp/sample-post or simply https://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 (.*) https://www.example.com.br/$1 [R=301,L]
    </IfModule>
    # END WordPress

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

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

Viewing 1 replies (of 1 total)
  • The topic ‘301 to new domain and server’ is closed to new replies.