Add file extensions to "pages" (4 posts)

  1. Paul Whitener Jr.
    Posted 7 years ago #

    I'd like to be able to add a file extension to a "Page" in v2.5. I have been able to modify my permalinks to add them to posts. Adding an extension to the permalink (in Manage/Pages) drops the period (the extension gets merged into the filename). Any help with this matter is most appreciated.


  2. Aeriff
    Posted 7 years ago #

    I have found a solution, it's not quite that elegant but it works. It could be better implemented (eg: check and dynamically input the permalink extension) but here's my fix:

    Line 510, /wp-includes/rewrite.php

    $this->page_structure = $this->root . '%pagename%';

    Change to:

    $this->page_structure = $this->root . '%pagename%.php';

    Or you can simply replace .php with the extension that your permalinks use. It has to be the same extension that's set in your Options > Permalinks or you'll get a 404 error.

  3. blumey
    Posted 7 years ago #

    I have been searching for hours for a way to force WordPress pages to have a .html or .php file extension - this is 100% perfect. I would also like to add that you can regulate your category, search, tag, etc. sections by doing the same thing to the lines previous to this one. Thanks for the help Aeriff!

  4. Rok
    Posted 7 years ago #

    Search for HTML to pages plugin, that'll do the job.

Topic Closed

This topic has been closed to new replies.

About this Topic