• Resolved lakers24kobe

    (@lakers24kobe)


    Hi
    I move my website to new host and use a new domain name, and the old domain also point to new host.
    I add this in .htaccess

    # BEGIN WordPress
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www.oldsite.com
    RewriteRule (.*) http://www.newsite.com/$1 [R=301,L]
    # END WordPress

    It’s not work so well, http://www.oldsite.com did redirect to http://www.newsite.com, but http://www.oldsite.com/* sitll http://www.oldsite.com/* with right page.

    I think maybe the code should be

    # BEGIN WordPress
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www.oldsite.com RewriteRule (.*)
    http://www.newsite.com/$1 [R=301,L]
    # END WordPress

    But it would be a 500 internal server error.
    Last time I got this error was enable Wordfence’s Falcon Engine and solved by add these codes in .htaccess from their docs.
    And change file access to 404 for solved this issue.
    Did those affect the 301 could not work fine?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Your initial redirect code looks fine to me, have you put that part on top of your .htaccess, before all other rules?

    Thread Starter lakers24kobe

    (@lakers24kobe)

    Hi,QXARE
    Thank you so much!!!
    I didn’t put it on top because that Wordfence docs says put their codes on top.
    It’s works fine after I put 301 codes on top.
    Thank you!!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘301 redirect to new domain’ is closed to new replies.