Support » Fixing WordPress » use htaccess to redirect to new base URL

  • I changed the base URL of my WordPress site from example.com to example-newsite.com

    I want to configure things so that if a user on the web tries to access example.com/any_page/ they will
    instead be redirected to example-newsite.com/any_page/

    I suspect the best way to do this is through .htaccess

    I have tried various things but have not gotten anything to work. For instance:

    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
    RewriteRule ^(.*)$ http://www.example-newsite.com/$1 [R=301,L]

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘use htaccess to redirect to new base URL’ is closed to new replies.