• i have moved my old wp to new domain on same server… with 300 posts, 200 categories and 200 tags.

    i need to know that should i 301 redirect from
    old.domain.com to newdomain.com

    or

    old.domain.com/post1 to newdomain.com/post1
    old.domain.com/catedory1 to newdomain.com/category1
    etc etc

    any guide pleas.

Viewing 3 replies - 1 through 3 (of 3 total)
  • From what I understand, you are trying to redirect everything from one domain to another completely different domain. If you are trying to move content from a subdomain to the main domain, the directions I am giving you will not work.

    This is a very straightforward description of what needs to be done:
    https://www.orderofbusiness.net/redirect-old-domain-to-new-domain-via-htaccess/

    Thread Starter aftab1003

    (@aftab1003)

    To redirect a single page to a new location on the same domain, use the following syntax:

    Redirect 301 /old/old.htm https://www.domain.com/new.htm

    thands woodent.

    in your suggested article, guide is to redirect every single page to new single page, right?

    as i said befor…

    olddomain.com/page1.htm to newdomain.com/page1.htm etc..
    pleas confirm… thanks

    If you use the following:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^olddomain.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www.olddomain.com$
    RewriteRule (.*)$ https://www.newdomain.com/$1 [R=301,L]

    You shouldn’t have to redirect each old page to the new page.

    What is happening with the code above is this (for example): A visitor goes to https://olddomain.com/myspecialpage.html. Since this request matches the first rewrite condition, the myspecialpage.html portion is stripped off and appended to the new domain, like this: https://www.newdomain.com/myspecialpage.html. Regardless of the page or directory requested, this code will redirect the visitor to the same location on the new site.

    The only instance where you will need to provide page-specific rules is when you change the URL for a page. For example, if you had a page on the old site located at: https://olddomain.com/thisdirectory/mypage and on the new site you wanted visitors to end up at https://www.newdomain.com/thatdirectory/mypage, you would need to setup a rule that would send people from /thisdirectory/ to /thatdirectory/. If you just relied on the code at the top of the page, the user would be sent to the right domain, but the wrong directory.

    So to answer your question specifically, just be sure ‘RewriteEngine On’ appears in your .htaccess file before the lines:

    RewriteCond %{HTTP_HOST} ^olddomain.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www.olddomain.com$
    RewriteRule (.*)$ https://www.newdomain.com/$1 [R=301,L]

    You don’t need to do anything else if you are just copying your WordPress site as is to a new domain.

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