301 Redirect for Multiple Pages to a New Domain

by Trivum
3 replies
I was wondering if someone could help me. I'm looking to combine multiple sites into one, and so I know I should 301 redirect my pages via my .htaccess file.

Can someone help me with the structure for doing multiple redirects? Could you, for example, help with the code for the following two examples? From that I'm guessing I'll just be able to keep doing it over and over.

(I'll also be changing up the titles and url structure as well. ... Not sure if that matters or not.)

1.
myoldsite.com/category/sub-category/this-is-my-article1-old-title.html

(move to >>)

newsite.com/article1-title


2.
myoldsite.com/category/sub-category/this-is-my-article2-old-title.html

(move to >>)

newsite.com/article2-title
#301 #domain #multiple #pages #redirect
  • Profile picture of the author Trivum
    Anyone have any ideas about this?

    Thanks.
    {{ DiscussionBoard.errors[6519477].message }}
    • Profile picture of the author Brandon Tanner
      Using your example, you would just need to put this in your .htaccess file...

      Code:
      redirect 301 http://myoldsite.com/category/sub-category/this-is-my-article1-old-title.html http://newsite.com/article1-title
      redirect 301 http://myoldsite.com/category/sub-category/this-is-my-article2-old-title.html http://newsite.com/article2-title
      Signature

      {{ DiscussionBoard.errors[6519675].message }}
  • Profile picture of the author Trivum
    Thanks, Brandon.

    Do I need anything else in the file? Whenever I look this stuff up, it says things like:
    Code:
    RewriteEngine on 
    RewriteCond %{HTTP_HOST} ^([^.:]+.)*oldsite.example.com.?(:[0-9]*)?$ [NC] 
    RewriteRule ^(.*)$ http://newsite.example.net/$1 [R=301,L]
    This is the stuff that throws me, and so I don't know how to apply it to the case mentioned above. Are those rules above only if the url structure is the same?
    {{ DiscussionBoard.errors[6520488].message }}

Trending Topics