Support » Plugin: WP2Static » Replace “index.php/” with another name

  • Hi thank you for the great software! For verion 4.0, I find it useful to:

    (1) Replace the index.php/ directory with other names (some servers confuse the index.php/ with index.html).

    In the StaticHtmlOutput.php file, add
    $fileDir = str_replace(“index.php”, “wpindex_php”, $fileDir);
    somewhere before “wp_mkdir_p( $fileDir );”, then add
    $fileName = str_replace(“index.php”, “wpindex_php”, $fileName);
    $fileContents = str_replace(“index.php”, “wpindex_php”, html_entity_decode($fileContents));”
    before “file_put_contents( $fileName, $fileContents );”.

    (2) In case the WP site is installed at a subdirectory under the “www root” directory, “$archiveDir” (StaticHtmlOutput.php) may be poorly defined and cause a “file not found” error when moving the static files. I solved it by appending the subdirectory name to the “$archiveDir” variable.

    Hope it helps~

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Leon Stafford


    Hi Yuan,

    Thanks very much for trying the plugin, I’m glad you had a good experience!

    Thanks also for the index.php rewrite block.

    Before I add it to the codebase or as an option, could you please let me know how you’re WordPress Permalinks are setup? I was not sure that the plugin could work without Permalinks set to something to avoid people seeing the index.php in URLs…

    You can reply here or send me an email to



    Hi Leon,

    Thanks for the reply!

    My perlink was set to something like “”. I chose to save the static HTMLs in a local directory (uploads/ by default) or download with a .zip file.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Replace “index.php/” with another name’ is closed to new replies.