How to Import a Large WordPress XML File and Override the Default Limits

Tutorials | 45 comments

Wordpress Blog - iconWordPress has a function in the administration area where you can export your blog content and import them unto a new blog installation. That works fine as is if you are importing a small file. However, when your file is larger than 2MB, the problem starts. The default limit for uploading an XML import file via the WordPress admin area is 2MB. Here’s a way to override that limit using htaccess.

First, open Notepad (or a text editor) to create a file and name it “.htaccess”

Upload this .htaccess file into the root directory of your server (where your site resides).

Cut and paste the code below into the .htaccess file:

#set max upload file size
php_value upload_max_filesize xxM

#set max post size
php_value post_max_size xxM

Change the “xx” variable to a number that meets your requirements. For example, my latest client needed me to import a 28MB XML file, so I just went ahead and changed the “xx” variable to 48. I was then able to import the WordPress XML file successfully.

Here’s what the final .htaccess file looks like:

#set max upload file size
php_value upload_max_filesize 48M

#set max post size
php_value post_max_size 48M

Hope this solution works out for you!

*If you need help with your WordPress blogs, just contact me with your project requirements. I’ll then respond with a quote accordingly.

You May Also Like

45 Comments

  1. Prince Vasquez

    Hi,

    I am having errors after uploading the edited .htaccess file

    import.php gives out 500 message error.

    Any ideas?

  2. After5PC

    Does your server support htaccess files? Some servers don’t allow htaccess to run. If your server supports htaccess, have you checked the file permission settings after uploading the file? CHMOD file permission of your htaccess file to 644 and try again.

  3. William Eisner

    I found your article and attempted to use it to fix my problem with WPMU.

    When attempting to upload an rss file smaller than 2MB, I get the “This file is to big. Files must be less than 120kb in size” response from the WPMU interface.

    I am looking for the restraint that is causing this issue.

    I have so far made modifications to:
    php.ini, admin.php, import.php,rss.php

    I am at a loss and would be greatly appreciative of any help you might provide in resolving this issue.

    Thank you for your assistance.

    William Eisner
    W.E. Enterprises/www.businessonahost.com

  4. After5PC

    Hi William,

    Sorry for the delayed response. I had been out of town and just got back…

    Has your problem been resolved?

    Try using the .htaccess solution and see if that works.

  5. eric

    wow that worked so simply!
    thanks

    wonder why wordpress wouldn’t let you upload larger files…

  6. Honey Singh

    Thanks for the suggestions and information’s,
    initially i used to do so via php.ini files.
    Now i implement the necessary changes in .htaccess files . 😛

  7. Rob Scott

    There’s every chance you’ll find it timing out at that large a size – might as well edit php.ini.

  8. April

    I’m having issues as well, and I’ve tried to add the file, I’m wondering if you can help me with it?

  9. Amanda

    that is not working for me. Please help!

  10. After5PC

    Amanda,

    Does your server support htaccess?
    If not, there are other ways to transfer your data.

    -Bryan
    After5PC.net

  11. Michale Sacca

    Thank you – that worked perfectly.

  12. jennie

    It was really helpful for my website. Thank you

    Jennie

  13. Ashish

    Friends This works perfectly.
    If you have VPS then we can control the maximum php upload size and php cluster size.
    The benefit of this Article is so much because most of the wordpress scripts run on shared hosting.

  14. Desktop Wallpaper

    As ashish says this also works well by edit php.ini

  15. bebe

    Hi, I tried the steps above, when I checked on the file manager on my web, they already have the “.htaccess” file.. and when I add the codes, it says internal error. Any advice?

    thx

  16. After5PC

    Where are you adding the code? It is probably placed in the wrong location

  17. puri

    I have the same problem.
    I added the code at different places.
    On the beginning and the end of the .htaccess file.
    And also one time only your code without any other code.
    Allways set CHMOD file permission to 644.

    I allways get the 500 message error.

    Do you know any other ways to bring the data back into my blog?

    Thank you in advance!
    puri

  18. After5PC

    puri,

    Sorry, I moved to a new location and just got my internet connection setup.

    Are you still having problems? If so, please contact me through the contact form on the site. I can troubleshoot the problem for you.

    Regards,

    Bryan
    After5PC.net

  19. Rishi

    Thnx Your Way Helped

  20. janie

    HELP! i am desperate to import from wordpress to blogger!!! my xmlis 1.70 and i have no idea what i’m doing!

  21. mercer

    tawkle!
    its safe free and unlimited

  22. fred

    where do u upload the .htacces file?
    in pubic_html?
    it will replace the existing one.
    and wp wont work?

  23. After5PC

    Fred,

    You can edit the existing .htaccess file to include the suggested coding.

    I would not suggest replacing it without backing up that file, because your existing .htaccess file may be used by another software in your server to serve its function.

  24. Ahsan

    You have to tell us full code which we put in htaccess file.
    when I put :
    # BEGIN WordPress# END WordPress
    No Error occur
    but when I put only :
    #set max upload file size
    php_value upload_max_filesize xxM

    #set max post size
    php_value post_max_size xxM
    500 internal error occur.
    Please tell me what we have to put in htaccess file or put in php.ini file???
    tell me datails…

  25. sola

    thanks yus, it work in my blog

  26. Patrick in Michigan

    tried it, didn’t work.

    try giving advice that actually works next time, ok?

    You’re welcome.

  27. After5PC

    Patrick,

    It worked for many. Perhaps it’s a user error? I can help you if you need my services.

  28. Luk

    hi,
    I managed to put the .htaccess file, it works…it shows me 100MB as i set 🙂 BUT ia m getiing this error:
    “File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini or by post_max_size being defined as smaller than upload_max_filesize in php.ini.”
    Help!
    thanks!

  29. MarkMcD

    Hi, I tried this and it worked fine to let me import a large XML file but then all my sites give a Internal Server error 500.

    Removing those lines restores the sites.

    Any ideas how to have the larger limit AND my sites?

    Thanks for the help so far…

  30. After5PC

    Mark,

    After you have successfully imported your files, you can then remove the above codes from your htaccess file

    Bryan
    http://www.After5PC.net

  31. S.M.Rashedul Alam Ovi

    Thanks the author. I really appreciate it. It’s very helpful everyone who don’t know about this code. I again I back this website.

  32. XML Import

    Thank you. Do you need to restart the server after changing the .htaccess?

  33. After5PC

    From what I recall, there’s no need to restart your server after making the changes. Just refresh your BROWSER and proceed.

  34. XML Import

    Thank you for your help After5PC :-).

  35. Paige

    Hi,

    first of all, thank you for this… it worked.

    unfortunately, i have server/host issues. to summarize it, my website experienced the wordpress white screen of death, my friend managed to fix it and then the newer posts disappearing then reappearing again a never ending cycle. So, i have decided in heavy heart to have it wiped out, delete it all.

    when im building my new website, i was happy to find your blog about the work around in uploading the backup file that is more then 2mb. and everything was fine. unfortunately, my website once again jumped to another version. the version where the wordpress was just freshly installed deleting all the changes and import uploads i made. So, i did what i did again, upload htaccess copy paste the thingy.. and this time it didnt work 🙁 the file permission is 644. still not working. so i am hoping you can help me on this? ^_^

    i am yet to google on where to find the php.ini file. il try some of the workarounds mentioned in the comments for now.

    Thank you

  36. After5PC

    Hi Paige,

    I’m glad you have found this posting helpful with your wordpress website. Are you still having problems? I’ve checked out the site, and it seems to be running fine on my end now. Hopefully, things have resolved. Cheers!

    -Bryan
    After5PC.net

  37. Paige

    Hi Bryan,

    Thanks for the reply.
    I guess i got tired of trying all the options i found in google on how to increase the limit, so i just looked for other options and found this software on breaking up the file so i can import it.

  38. ipl 2015

    Thanks for sharing

  39. Daqve

    That code killed my entire site. I removed it and everything returned to normal.

  40. After5PC

    Does your server support htaccess, or did you input the codes correctly? Otherwise, you will receive a server error.

    Regards,

    Bryan
    After5PC.net

  41. richard

    the existing htaccess file has
    # BEGIN WordPress

    # END WordPress

    do you put this new code

    #set max upload file size
    php_value upload_max_filesize 48M

    #set max post size
    php_value post_max_size 48M

    in between the above , before or after?

  42. After5PC

    Is this the only thing in your htaccess file? I am assuming your site is fully WP-based then.

    Place this code outside the existing WordPress code. So either before or after should work.

  43. ameen

    perfectly works

Trackbacks/Pingbacks

  1. ArtLung : Migrating an old Blogger blog to WordPress ~ 02 Mar 2010 - [...] If the file is too large, then you can try overriding the various file upload limits under PHP, and…

Submit a Comment

Your email address will not be published. Required fields are marked *

Categories

Powerful SMS Mass Texting System For Your Organization

Use my incredible AFTER5PC SMS system to TRANSFORM your existing Android phone into a POWERFUL mass texting and marketing communication tool! My SMS gateway is perfect for churches, small businesses, and other organizations of all sizes.

Ecommerce + Chatbot + Email + SMS + Social Media Automation

Use this amazing platform to get all the tools that you need in order for your business to succeed online! This powerful all-in-one system is the most cost-effective way to connect to your existing customers or to obtain fresh leads and get more sales!

 CLAIM YOUR COMPLIMENTARY CERTIFICATE

Limited-Time Special Offer For New Web Design Clients  

$1,000 OFF RESTAURANTS AND GROCERIES

Enjoy $1,000 worth of coupons from your choice of favorite restaurants and fast good chains, plus grocery coupons of your choice! These are restaurants such as TGIF Fridays, Chili’s, Olive Garden, Red Lobster, Applebee’s, Sizzler, I-Hop, Denny’s just to list a few. Also includes fast food chains such as McDonald's, Hardee's, Quizno's, Taco Bell, Dairy Queen, Burger King, Carl's Jr., Jack-In-The-Box and many more. Plus, enjoy grocery coupons from a list of national brand name products that will definitely save your family money. Total savings of $1,000! This offer is valid for USA residents only.