WordPress.org

Ready to get started?Download WordPress

Forums

Move/Migrate old site to WordPress on same domain - how to 301 redirect (36 posts)

  1. jumust
    Member
    Posted 2 years ago #

    Hi,
    I have my old site (it's not in wordpress) on http://www.mysite.com and now I want to migrate to WordPress (using the same domain). To keep all posts I have for SEO benefits I thought to use a 301 redirect but I'm not sure if this plan works:

    - I'd like to use one of these plugins Redirection or Simple 301 redirect
    - Install WordPress in subdirectory but Display the url of the root with this Giving_WordPress_Its_Own_Directory

    Will it work?

    Thanks

  2. Brad Markle
    Member
    Posted 2 years ago #

    Hi jumust. I'm not familiar with the redirect plugins myself, but I know my colleagues have tested several of them and they do work.

    Is there a specific reason you're wanting to put wordpress in a sub directory? You should be able to go that route and use .htaccess to only show the main domain (and not the installed sub directory), but that doesn't sound like the easiest way to go.

  3. jumust
    Member
    Posted 2 years ago #

    Hey Brad,
    I want to use the subdirectory only because in the root there are files of old site and I'm worried to mess things up. I should not delete old files, right?

    With those plugins I should do everything manually, example
    Old site : http://www.mysite.com/articles.php?subcategory_id=68
    New site : http://www.mysite.com/category

    Or

    Old site : http://www.mysite.com/article/35523/postname
    New site : http://www.mysite.com/category/postname

    Will it work? There is no solution to make things automatically? Is this the cleanest way to not lose all google benefit?

    Thanks

  4. Brad Markle
    Member
    Posted 2 years ago #

    There is no solution to make things automatically?

    Any of the plugins you listed above look like they will do the job for you, but I don't believe you're going to be able to do things automatically. Unless you are familiar with php, it would be quite difficult to automate the redirects.

    How many articles would you say you have on your old site? Are we talking tens or hundreds (or more?)

    Is this the cleanest way to not lose all google benefit?

    Yes, using 301 redirects should be the best route for redirecting old pages to their new pages.

  5. jumust
    Member
    Posted 2 years ago #

    Thanks Brad!

    I would say I have hundreds articles....
    So what I should do is manually copy in WordPress post and for each of them use 301 redirect destination url, example:

    Original url : http://www.mysite.com/article/35523/postname
    Destination url : http://www.mysite.com/category/postname

    So does it matter if I install wordpress in the root directory where there is already the old site?

  6. Brad Markle
    Member
    Posted 2 years ago #

    So what I should do is manually copy in WordPress post and for each of them use 301 redirect destination url, example:

    Yes.

    So does it matter if I install wordpress in the root directory where there is already the old site?

    You can install WordPress anywhere you'd like, but for setup reasons, putting it in the root directory may be the more easy route.

    The problem I see is that you're going to have is it will be quite tedious to setup 100's of those 301 redirects.

  7. jumust
    Member
    Posted 2 years ago #

    Yes I know,
    it would be quite tedious...
    I don't really know how to start with php to make it automatic, do you know any tutorial where I can get a basic code and then I'll try to adapt it with the url structure I have in the old site?

    Thanks

  8. Brad Markle
    Member
    Posted 2 years ago #

    I may be able to help.

    What I'll need is a CSV file listing all of your currently URLs. Then, I would need to know the "/category/" that should show for each url.

  9. jumust - You can do it progamatically via .htaccess and regex if the URLs you're currently using are in a standard format.

    Moving from domain.com/postname to domain.com/postname can be done by just makign sure you use the permalink value of %postname% on WordPress, and then editing each post to have the same name.

    Basically you'll have to do it manually and that sucks :/

  10. jumust
    Member
    Posted 2 years ago #

    Thanks guys but I need to figure out a bit...

    Brad thanks for your help but since it's something I'm going to do later on next month I'd like to learn so then I can do it by myself, now I can't give you any CSV...don't know yet new categories.
    I'm trying to see if it's convenient to migrate to WordPress

    Ipstenu I'm not sure if I catch what you say but sounds like I can do it programmatically via .htaccess and regex.

    What I have now in my site is:
    Category url: http://www.domain.com/category.php?id=3#
    Subcategory url: http://www.domain.com/articles.php?subcategory_id=87
    Post url: http://www.domain.com/article/35034
    Page url: http://www.domain.com/page.php?id=about

    I think I'll use in WordPress custom permalinks:
    /%category%/%postname%/

    I'd appreciate any suggestions

    Thanks

  11. Brad Markle
    Member
    Posted 2 years ago #

    I tend to do things the hard way. If you created an array of old urls, such as:

    http://www.mysite.com/article/35523/postname
    http://www.mysite.com/article/35524/postname
    http://www.mysite.com/article/35525/postname

    ... You could then loop through each link, grab the item after the last / in the url, and then build your new urls. When building the new urls, you would also create 301 redirects that you could place in your .htaccess

    Redirect 301 /oldpage.html http://www.yoursite.com/newpage.html

    The thing is that you're going to have 100's of these 301 redirects in your .htaccess, but I don't think that'll be a big problem.

    ALSO:

    In a previous post, I found out that WordPress has an automated redirect method built in. What I mean by this is that:

    If your current URL is:
    http://domain.com/category/hello-world

    You could visit any of the following URLS (mis typed urls):
    http://domain.com/blah/hello-world
    http://domain.com/blah/blah/hello-world

    ... and it would redirect to the correct post:
    http://domain.com/category/hello-world

    So, technically, if all of your article titles match up exactly on your old site and new site, you may not need to do anything.

  12. jumust
    Member
    Posted 2 years ago #

    Great I didn't know about the built in automated redirect method. It should do the job! And without do anything!!! :)
    So if I want to develop the new site and start to insert all articles, where do you suggest to install it to keep the actual site working until the switch to WordPress is ready?

    Should I work on another server and then move everything over to the root of the actual server?

  13. Brad Markle
    Member
    Posted 2 years ago #

    So if I want to develop the new site and start to insert all articles, where do you suggest to install it to keep the actual site working until the switch to WordPress is ready?

    It really doesn't matter where you install it. You could try dev.domain.com or domain.com/wordpress or domain.com/dev. The bottom line is that after you design and build your site, you'll need to follow the steps to move WordPress to another folder (which really isn't that hard).

  14. jumust
    Member
    Posted 2 years ago #

    Ok, my concern is:
    Let's say I install in the root, my actual site will be down or there will be any conflict?

    If not, let's any both sites will live together in the root. Once I start to insert all articles with the same name of old ones, users who will visit the actual site will be redirected to the development site, right?

    How to avoid all this?

  15. Brad Markle
    Member
    Posted 2 years ago #

    You don't want to install more than one application in the same folder. You can have one website in public_html and one in public_html/wordpress, but you don't want to have two websites sharing the same parent folder.

    What I would do is:
    1. Keep your current site live in the root
    2. Create your WordPress site in a /dev folder (like domain.com)
    3. Once your WordPress site is live and ready to go, remove all the files for your main site and move the files from /dev into the root folder.
    4. Test test test!

    Be sure that throughout this process you have backups of your site. Don't delete files in mass without having a backup.

    You may also want to plan to do this change when traffic to your site is at its lowest, for example late in the evening. In this way, you won't have many visitors seeing the change (or any errors) as it happens.

  16. jumust
    Member
    Posted 2 years ago #

    Thanks for all your suggestions.

    One question:
    If I remove all files from the main site, then I'll lose the old content and how does url redirection work? Users who go to the old url will not be redirected but just will see "Page not found"?

    Sorry for all questions but really I can't make mistake on the live site

  17. Brad Markle
    Member
    Posted 2 years ago #

    Hi jumust, right after you remove the files for your main website, you will need to copy the files from your wordpress site into your root folder so that wordpress will then become your main website.

    ANOTHER OPTION:
    Another option that you have is to simply change the document root for your main domain. This would be less destructive as the first option (as you're not going to need to delete any files), but it most likely will require that you contact your hosting provider for help. Updating your document root is basically telling the server that for domain.com, instead of loading the files directly in public_html, load the files from public_html/wordpress. Our support team is able to do this for our users, and I'm sure your host can do this for you as well.

    You can find more info about this at Where should I upload my files? - The Document Root

  18. kdarkman
    Member
    Posted 2 years ago #

    Brad, you just nailed it!
    I had to do this manually for a client who used a host that required
    WP be installed in a sub-folder. One thing, though, I didn't delete
    the old site files.

    The WP dev site was in a folder excluded by robots.txt with the WP
    search settings set to off. then...

    I built out the new WP site and recreated the pages I wanted to
    transfer.

    When everything was as I wanted it. I set the doc root via .htaccess
    and let the support team do what you suggested.

    In order to preserve inbound links and bookmarks that were built to the old site, I left those pages in place. Once the site root is
    changed they'll be invisible except for those who are directly linking
    to the old pages.

    I then (while the site root was updating) emptied the old site pages
    of their content and replaced it with a javascript 301 redirect code.
    Everything went smoothly.

    The key for me was to plan it out on paper first. The execution is mostly copy, cut, and paste.

    Hopefully Jumust is working from a local server. If so, it takes about
    8 hours and 5 cups of coffee to do ~120 pages.

    p.s.
    (google "301 redirect for seo" for more help-- if that's the main
    consideration)

  19. jumust
    Member
    Posted 2 years ago #

    Ok thanks guys, I have a consideration:

    I then (while the site root was updating) emptied the old site pages
    of their content and replaced it with a javascript 301 redirect code.

    If I don't remove old pages, and I don't yse any javascript 301 redirect code, does wordpress redirect automatically the post with same name as we discussed above?

    If so I should
    - build the WP site in a Folder
    - once I finished and copied all content from the old site I should let Hosting team change the root to Folder
    - WP will redirect automatically the old posts to the new posts

    RIGHT?

  20. kdarkman
    Member
    Posted 2 years ago #

    Hi Jumust,
    Just a couple of questions.
    What plaform is the old site on, and how many pages are you moving?

    If so I should
    - build the WP site in a Folder
    - once I finished and copied all content from the old site I should let Hosting team change the root to Folder
    - WP will redirect automatically the old posts to the new posts

    Yes. Yes. and No.

    Here's the problem with redirecting the page content into WordPress:

    These are dynamic pages. They only exist when you call for them. Your old site pages are in one database (?), while the new site pages are in another.

    We have to use 301 to permanently redirect the old page names to the new page names. Whether it's done
    manually (i.e., scripting) or by plugin(?). The upside is that this
    last part is the easiest. Or, rather, not the hardest. More
    importantly, it's the part that "saves the store".

    Actually, the javascript method I used is "frowned upon". If you can't use the .htaccess method, the HTTP/1.1 301 Moved Permanently is more
    correct. (Some of this has to do with what permissions you have and
    what platform you're moving from)

    Here are plug and play scripts and coding for a variety of situations:
    http://www.isitebuild.com/301-redirect.htm
    http://www.phatz.com/301redirect.php
    http://www.webconfs.com/how-to-redirect-a-webpage.php

    Another thing I think worth mentioning-- just for the sake of
    perspective-- is that acquiring links and se rankings + the traffic
    that comes with them, is not a quick and easy process. Preserving those
    benefits (in my opinion) might be worth the "stretch". That's what I
    meant by "saves the store".

  21. jumust
    Member
    Posted 2 years ago #

    Oh my Gosh it sounds tough now.

    Firstly I'll answer your questions @kdarkman:
    - My old site is not on any platform open source, so just built with dreamweaver
    - I'm going to move hundreds articles

    Now according my discussion with @Brad above we concluded that WordPress has a built in redirection method but now it has been discarded. So I'm confused I don't know what to do, I think a safe and easy way would be:

    1. INSTALL WORDPRESS IN A SUB-FOLDER
    2. COPY ALL OLD POST IN WORDPRESS SITE MANUALLY
    3. ASK HOSTING TEAM TO MAKE ROOT AS SUB-FOLDER
    4. INSTALL WP REDIRECT PLUGIN AND FOR EACH NEW POST SET UP THE ORIGIN AND DESTINATION URL.

    Please let me know your thoughts....

  22. kdarkman
    Member
    Posted 2 years ago #

    Jumust,

    Actually it's not tough, just time consuming. A flat html
    Dreamweaver site is exactly what I moved from. I don't know about the
    redirect plugin. I never even looked for one.

    You think the redirect is the hard part-- not even close! It's moving
    the files that's tedious-- especially if they have a lot of contextual
    links.

    Here's how I did it. You already have the first 3 areas down-pat.
    Here's the final step.

    Set up your game plan on paper. Layout the structure for the WP site in advance so you'll know what goes where.
    [old folder names | old articles] --> [new categories | new articles]

    Layout a calendar to schedule the tasks (10 articles/pages a day x 30
    days = 300 articles). Ten articles = 30 minutes-- tops!

    Now... Your WP site isn't live. You're building it page by page. Open
    two browser tabs so you can copy the old article to the WP article "shell" like this:

    Open a DW html article in a browser just like it would be on the web.
    Select all the text and copy it into a text file-- the html tags
    will be removed. Then copy it from the text file and paste it into the
    WP editor. There's your new un-formatted article. (You could really do
    it w/out a text file-- that's just the way I did it.)

    If you had inner site links in the text, make a note of what article
    they are supposed to link to. Just set an empty link. You have to wait
    until the final destination is determined. (I just kept my notes in a
    text file, but if I did it again, I'd use a spreadsheet).

    When WP site is finished, and while the new site root is being propagated, just go into Dreamweaver and open every file in the site, one-by-one or, in batches of tabs.

    Insert the 301 redirect code using either the HTTP method (which I
    would do "next time")or with the javascript inside the head tags. Then delete all the content between the body tags. Copy-paste-delete-save, over and over again. That's what worked for me.
    What do you think?

  23. jumust
    Member
    Posted 2 years ago #

    Ok Perfect. Actually I'm not worried about moving content, I have a guy who'll take care of this.

    So the last question is:

    - After I set up the site in subfolder, can I use the 301 redirect plugin instead of edit all files (and insert the 301 code)?
    So while I'm coping posts I'll set up the url too (the old one that should be redirected to the new post)

    Finally I'll propagate the new site root....

    What do you think?

  24. Brad Markle
    Member
    Posted 2 years ago #

    - After I set up the site in subfolder, can I use the 301 redirect plugin instead of edit all files (and insert the 301 code)?
    So while I'm coping posts I'll set up the url too (the old one that should be redirected to the new post)

    If you were to edit each file individually, you could actually use php code to perform the redirect, and you could use the same php code on each page (simply copy and paste).

    You could also poke around a bit and find a .htaccess rule that can do all of the redirecting for you. I'm not sure exactly how this will work, but we could do a bit of research and get you a good answer.

  25. jumust
    Member
    Posted 2 years ago #

    Actually let's say that I'll not open the old file in php, just I'll copy the article content and paste it in the new Wp post.
    So I'll not put the redirect code in the old file but just with the WordPress redirect plugin I could set up in the Wp post admin the old url.

    If there is an automatic way it would be wonderful so after I pasted all content I don't need to do anything. Otherwise with the plugin above should be ok, right?

    Please let me know if I didn't catch what you said

  26. kdarkman
    Member
    Posted 2 years ago #

    I'm not clear on how this redirect plugin works. I'd like to hear more about it. I can't imagine how it would be able to re-direct pages it didn't create and can't edit.

    Maybe someone can fill us both in. Meanwhile I'm going to see if
    I can find some more info about it. If I do, I'll post it here.

  27. jumust
    Member
    Posted 2 years ago #

    That's right, maybe that plugin works only between two wordpress site....or in the same wordpress site.

    If I understood, the system should be able to get into old files...so maybe with .htaccess like Brad said...

    How do you 301 redirect from Dreamweaver flat site to WordPress site?

    Any help please post here

  28. Brad Markle
    Member
    Posted 2 years ago #

    How do you 301 redirect from Dreamweaver flat site to WordPress site?

    If you're using dreamweaver, you can add the javascript code I mentioned above to redirect a user from one URL to another.

    Let me know if I've misunderstood your question.

  29. kdarkman
    Member
    Posted 2 years ago #

    Brad, I agree with you on this-- and Jumust I just found this 2009 thread on Google, i.e., AT Google.
    http://www.google.com/support/forum/p/Webmasters/thread?tid=5dbf9fb5506fbee8&hl=en

  30. jumust
    Member
    Posted 2 years ago #

    Sorry I don't know how to explain, but just I can access to files of my old site from FTP, so no dreamweaver....even though I think it's same, you are saying that I need to put the code into each file, right?

    So no plugins, no automatic way with .htaccess:
    I should build my WP site in subfolder, propagate the new root and then add the redirect code to each file...

Topic Closed

This topic has been closed to new replies.

About this Topic