Title: [Plugin: HTML Import 2] Importing Static HTML Pages
Last modified: August 20, 2016

---

# [Plugin: HTML Import 2] Importing Static HTML Pages

 *  Resolved [joshkellman](https://wordpress.org/support/users/joshkellman/)
 * (@joshkellman)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/plugin-html-import-2-importing-static-html-pages/)
 * Hello,
 * I installed WordPress in a sub-directory on my site so I could import the pages
   and install a new theme.
 * I’m getting this error message when using the plug-in:
 * Warning: scandir(/home/content/06/7327206/html/wp/html-files-to-import) [function.
   scandir]: failed to open dir: No such file or directory in /home/content/06/7327206/
   html/wp/wp-content/plugins/import-html-pages/html-importer.php on line 210
 * Warning: scandir() [function.scandir]: (errno 2): No such file or directory in/
   home/content/06/7327206/html/wp/wp-content/plugins/import-html-pages/html-importer.
   php on line 210
 * Warning: Invalid argument supplied for foreach() in /home/content/06/7327206/
   html/wp/wp-content/plugins/import-html-pages/html-importer.php on line 211
 * Warning: Invalid argument supplied for foreach() in /home/content/06/7327206/
   html/wp/wp-content/plugins/import-html-pages/html-importer.php on line 642
 * Help please.
 * Thanks,
    Josh
 * [http://wordpress.org/extend/plugins/import-html-pages/](http://wordpress.org/extend/plugins/import-html-pages/)

Viewing 15 replies - 1 through 15 (of 22 total)

1 [2](https://wordpress.org/support/topic/plugin-html-import-2-importing-static-html-pages/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/plugin-html-import-2-importing-static-html-pages/page/2/?output_format=md)

 *  Plugin Author [Stephanie Leary](https://wordpress.org/support/users/sillybean/)
 * (@sillybean)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/plugin-html-import-2-importing-static-html-pages/#post-2251043)
 * This almost always happens because you don’t have your beginning directory option
   set correctly — that’s why it says “no such file or directory.” It should be 
   a complete path from the server root — in this case, it should start with `/home/
   content/06/7327206/html` — and it must be a path to files on the same server,
   not a URL to some other site.
 * See the [user guide](http://sillybean.net/downloads/html-import/user-guide.html)
   for more details.
 *  [tsbah](https://wordpress.org/support/users/tsbah/)
 * (@tsbah)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/plugin-html-import-2-importing-static-html-pages/#post-2251246)
 * Hello Stephanie,
 * My apologies if you get this message twice.
 * I configured all tabs in HTML Import 2/Settings. Then I tested the plugin with
   two clean XHTML files. But the import returned only the title, leaving the content
   area blank.
 * Again, both files pass the local (BBEdit) and external (W3C Validator) test.
 * TIA
 *  [mrose17](https://wordpress.org/support/users/mrose17/)
 * (@mrose17)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/plugin-html-import-2-importing-static-html-pages/#post-2251247)
 * tsbah – if you aren’t seeing any errors, but the content area is blank, look 
   at the “Content” tab under “Settings > HTML Import” – under “Select Content by”
   you have to enter the HTML tag that contains the content. usually, you also have
   to specify an attribute value as well. for example, if you want to import everything
   in
 * <div id=’content’> … </div>
 * then the tag is ‘div’, the attribute is ‘id’, and the value is ‘content’ (do 
   not enter the single-quotes).
 * if the element isn’t present in the HTML file, then you are going to get posts
   without any content…
 *  [kpelham](https://wordpress.org/support/users/kpelham/)
 * (@kpelham)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-html-import-2-importing-static-html-pages/#post-2251255)
 * I had this problem too. I don’t do well with exact url’s so I uploaded a file
   I called t.php to the directory. On the file is:
    <html><body><?php echo getcwd();?
   ></body></html>
 * Go to the page in your browser and it will give you the exact url! [http://www.mysite.com/thefolder/t.php](http://www.mysite.com/thefolder/t.php)
 * I still had the problem. Figured out the copy/paste of the exact url added an“
   invisible” space at the end of the url. argh! Deleted the extra “invisibles” 
   and taaadaaa! It works!! THANK YOU THANK YOU THANK YOU!
 *  [rudy3107](https://wordpress.org/support/users/rudy3107/)
 * (@rudy3107)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-html-import-2-importing-static-html-pages/#post-2251277)
 * Nice work Stephanie Leary
 * it worked well; without reading user guide.
 * my only problem is it create file name with its title;
    is there any way keep
   old file name intact
 * as in main index.html file its calling 1.htm but when i imported it makes “long
   title name.html”
 * Let me know how to keep old names.
 *  [Mark Tuttle](https://wordpress.org/support/users/markrtuttle/)
 * (@markrtuttle)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-html-import-2-importing-static-html-pages/#post-2251281)
 * I’m not the plugin author, but a [subsequent poster asked a similar question](http://wordpress.org/support/topic/plugin-html-import-2-how-do-i-keep-the-existing-slugs?replies=2).
 * I have manually patched slugs to match filenames by computing the mapping $id-
   >$filename from post id to filename, and then writing a script to essentially
 *     ```
       $post = get_page($id);
       $post['post_name'] = $filename;
       wp_update_post($post);
       ```
   
 * By the way, your request is reasonable, but I’m not certain it is always possible.
   There seems to be some requirement that slugs are unique (although I’ve gotten
   away with slugs that are not unique for reasons I can’t explain), so if you have
   two files with the same name FILENAME you might end up with posts having slugs
   FILENAME and FILENAME-2.
 *  [rudy3107](https://wordpress.org/support/users/rudy3107/)
 * (@rudy3107)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-html-import-2-importing-static-html-pages/#post-2251283)
 * Thank you Very much.
    As im importing whole directory, and in same directory 
   its not possible to keep 2 files with same name. (other than with different extention)
 * i will try if its works for me.
 * Thank you Very much Again.
 *  [rudy3107](https://wordpress.org/support/users/rudy3107/)
 * (@rudy3107)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-html-import-2-importing-static-html-pages/#post-2251284)
 * Sorry to say;
 * i tried to go thru your other post; but i did`t understood.
    can you tell me 
   step by step as im dunno ABCD of php or scripts
 * i have to add $my_post[‘post_name’] = $slug;
    in html-importer.php, before the
   post insertion code.
 * then i did not understood this part
    —> I have manually patched slugs to match
   filenames by computing the mapping $id->$filename from post id to filename, and
   then writing a script to essentially $post = get_page($id); $post[‘post_name’]
   = $filename; wp_update_post($post);
 * <—
 *  [Mark Tuttle](https://wordpress.org/support/users/markrtuttle/)
 * (@markrtuttle)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-html-import-2-importing-static-html-pages/#post-2251285)
 * If you are not already comfortable with php scripting, and since your target 
   is a single directory of files, it is probably faster and safer to bite the bullet
   and change the slugs manually one page at a time (dashboard -> pages -> all pages-
   > edit). A single evening of boring manual labor in front of the television will
   probably get the job done, and then it will be over.
 *  [rudy3107](https://wordpress.org/support/users/rudy3107/)
 * (@rudy3107)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-html-import-2-importing-static-html-pages/#post-2251286)
 * Im uploading whole Law manual, as i already did some 11,000 pages.
    here [http://mynation.net/laws/](http://mynation.net/laws/)
   still around 20,000 to go.
 * i did it hard way. i imported to local PC developing enviornment then exported
   to XML and in XML file i updated manually to each file slug as in Index file
 * eg : like this ipc.htm [ [http://mynation.net/laws/bare-acts/ipc/ipc.htm](http://mynation.net/laws/bare-acts/ipc/ipc.htm)]
   is calling some 511 sub pages. so i changed accordingly in index page [ipc.htm]
   and chnaged all file names.
 * Which took me 3 months to import and change 11,000 pages.
 * if its import same file name then its easy, no need to do manual changes, and
   can be imported in 3 days.
 * thats why i asked.
 *  [rudy3107](https://wordpress.org/support/users/rudy3107/)
 * (@rudy3107)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-html-import-2-importing-static-html-pages/#post-2251287)
 * just found out sillybean had BabY on 22/12/11
 * thats why there is no update or modification in this plugin.
 *  Plugin Author [Stephanie Leary](https://wordpress.org/support/users/sillybean/)
 * (@sillybean)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-html-import-2-importing-static-html-pages/#post-2251290)
 * Yes, the new baby is a big distraction. 🙂 I’m just getting back to WordPress
   stuff. Thanks for your patience.
 * The redirect feature is intended to eliminate the need for matching slugs — that
   is, it won’t matter that the new slugs don’t match the old ones, because visitors
   will be redirected to the new address anyway. And that’s there for exactly the
   reason Mark pointed out: WordPress requires unique slugs, even for children of
   different parent pages.
 * Nevertheless, I get a lot of requests for this feature.
 * If you want to try it anyway, try this:
 * find line 579 in html-import.php — the blank line after
    `$my_post = array();`
 * Add this:
    `$my_post['post_name'] = $val;`
 *  [rudy3107](https://wordpress.org/support/users/rudy3107/)
 * (@rudy3107)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-html-import-2-importing-static-html-pages/#post-2251291)
 * its in html-importer.php not in html-import.php
 *  [rudy3107](https://wordpress.org/support/users/rudy3107/)
 * (@rudy3107)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-html-import-2-importing-static-html-pages/#post-2251292)
 * no its not working.
    its still creating pages with TITLE not with original SLUGS.
 * indrict is ok but on main index file there are links to old SLUG names that make
   to fail whole import.
 * as i told in my earlier post.
 *  [rudy3107](https://wordpress.org/support/users/rudy3107/)
 * (@rudy3107)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-html-import-2-importing-static-html-pages/#post-2251298)
 * Any hope in getting updated version to keep original SLUGs.
 * i have still 56000 pages to go
    so far i imported only 13,000 by changing SLUGs
   one by one here [http://mynation.net/laws/](http://mynation.net/laws/)

Viewing 15 replies - 1 through 15 (of 22 total)

1 [2](https://wordpress.org/support/topic/plugin-html-import-2-importing-static-html-pages/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/plugin-html-import-2-importing-static-html-pages/page/2/?output_format=md)

The topic ‘[Plugin: HTML Import 2] Importing Static HTML Pages’ is closed to new
replies.

 * ![](https://s.w.org/plugins/geopattern-icon/import-html-pages.svg)
 * [HTML Import 2](https://wordpress.org/plugins/import-html-pages/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/import-html-pages/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/import-html-pages/)
 * [Active Topics](https://wordpress.org/support/plugin/import-html-pages/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/import-html-pages/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/import-html-pages/reviews/)

 * 22 replies
 * 8 participants
 * Last reply from: [rudy3107](https://wordpress.org/support/users/rudy3107/)
 * Last activity: [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-html-import-2-importing-static-html-pages/page/2/#post-2251311)
 * Status: resolved