Viewing 3 replies - 1 through 3 (of 3 total)
  • First, why would one *need* to have the extension?

    Second, just the one Page? Hmm.

    Using custom permalinks and mod_rewrite you might add to your .htaccess a line that “translates” /blah.php to a path WordPress can properly handle, like:

    RewriteRule ^(blah).php$ /index.php?pagename=$1 [QSA]

    The issue here is that WordPress would know nothing about the new link, so it will continue providing /blah as the link to the Page. This is a manual linking solution.

    Another option is to set up a blah.php file that is “WordPress enabled”, meaning before it does anything else, it calls the wp-blog-header.php file, like so:

    <?php
    include('./wp-blog-header.php');
    ?>

    (Make sure the path to wp-blog-header.php is correct.)

    You can then do everything a regular WordPress template can do. Easy way to make such a file is to copy a theme’s page.php (or other) template and add the code above before everything else in it. To have it display a Page’s contents, before The Loop you can initialize the specific Page through query_posts().

    This is another manual linking option, since (again) WordPress will be ignorant of it. To get WordPress to know what you’re doing would require a combination of the rewrite rule above with some custom editing of the core code.

    Thread Starter mayreee

    (@mayreee)

    I am using a q&a script and it seemed the form needed to have the page be submitted to a page with a .php extension.

    Thank you very much for your help!!! I made it a seperate page with my page.php template and it worked great. Thanks again!

    An alternative to this in the future would also be to hack the php script and not make it have a forced .php extension, just in case someone looks up this post.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Make a page have a .php extension?’ is closed to new replies.