• Resolved nadaras

    (@nadaras)


    Hey ??

    I want to switch from domain.com to newdomain.com
    My approach is Settings – General -> WordPress Address (URL) /
    Site Address (URL)
    and there to put in the new domain.
    This will change all links i guess inside the blog.
    But it won’t make 301 redirects from the old domain to the new URLs.
    Is there a Plugin who could to that?
    I thought to crawl all Links from my webpage, and just change with a editor the domain. And than i would put it in to the .htaccess

Viewing 7 replies - 1 through 7 (of 7 total)
  • It is a little more complicated than that because of the dynamic pages WP generates.
    https://codex.www.ads-software.com/Moving_WordPress#Changing_Your_Domain_Name_and_URLs

    Make sure you have a db backup.

    Thread Starter nadaras

    (@nadaras)

    Hey kmessinger it seems like i didn’t wrote my problem precisely.

    I use the same server i didn’t migrate it anyware.
    I just want to change the domain of the existing wordpress installation. On the same server..
    And i don’t use dynamic generated URLs is use the Postname.
    I already rooted the new domain to the server and to the folder, it seems like all urls are working when i just replace the domain in the URL bar in the browser.
    Now i have to change the URLs site wide and as main domain. And as last all old domains 301 redirected to the new URLs which are nearly the same because the only difference is the domain part of the URLs.

    This in the .htaccess should work:

    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^domain\.com$
    RewriteRule ^(.*)$ https://newdomain\.com/$1 [R=301,L]
    </IfModule>

    Thread Starter nadaras

    (@nadaras)

    Hey MarkRH ??

    Seems like it is still not working my .htaccess:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    RewriteEngine on
    RewriteCond %{http_host} ^www.jailbreaklab.eu$ [OR]
    RewriteCond %{http_host} ^jailbreaklab.eu$ [NC]
    RewriteRule ^(.*)$ https://www.jailbreak.pro/$1 [R=301,L]
    </IfModule>
    
    # END WordPress

    I also found you solution more often in the Internet.
    It is only redirecting the domain so the main URL but not every sub URL thay just stay with the old URL in the browser bar.

    Might re-arrange things:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{http_host} ^www\.jailbreaklab\.eu$ [OR]
    RewriteCond %{http_host} ^jailbreaklab\.eu$
    RewriteRule ^(.*)$ https://www.jailbreak.pro/$1 [R=301,L]
    
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress

    Before, those rewrite rules were never executed because the rules before them were catching the URL and stopping execution.

    Thread Starter nadaras

    (@nadaras)

    Oh my god! Thank you so much MarkRH !!! <3
    The Internet lives so beautiful only because of People like you!
    Thank you ?? it works like a charm ;D

    Glad it worked! If you happen to read this, might mark the thread as resolved.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Switch Domain – How to 301 redirect automatically?’ is closed to new replies.