dongye6377
2014-06-22 21:04
浏览 134
已采纳

如何使用wordpress网站执行自定义php文件

I have installed wordpress blog in my domain(Ex: http://mywordpresswebsite.com). Now i have a php file called serve.php in the root like http://mywordpresswebsite.com/serve.php.

Now if i open the url in browser its saying page not found.

then i have added RewriteRule ^serve.php$ serve.php [L] in htaccess code, still its saying page not found.

Please give me a solution for this as soon as possible, thanks in advance.

图片转代码服务由CSDN问答提供 功能建议

我在我的域中安装了wordpress博客( Ex:http://mywordpresswebsite.com )。 现在我在根目录中有一个名为 serve.php 的php文件,如 http://mywordpresswebsite.com/serve.php

现在,如果我在浏览器中打开它的说法页面未找到。

然后我添加了RewriteRule ^ serve.php $ serve.php [L] in htaccess代码,仍然没有找到它的说法页。

请尽快给我一个解决方案,提前谢谢。

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • douliang7068 2014-06-22 21:40
    已采纳

    Wordpress templates are located in wp-content/themes/yourthemename/. Easy way to load a custom php file is to put serve.php in that folder and to make that file a page template by putting comment below at the beginning of the file:

    <?php
    /*
    Template Name: Serve
    */
    

    Now go to admin->pages, create a new page and assign that page template from the template dropdown. Open the http://mywordpresswebsite.com/serve/ url in browser ( click on Show Page in admin bar ) and serve.php will be loaded.

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题