简体   繁体   English

服务器端包含-PHP

[英]Server Side Include - php

I'm updating a site that is currently static html (ie index.html). 我正在更新当前为静态html(即index.html)的网站。 I'd like to pull in blog posts into the page and only know of SimplePie to accomplish this. 我想将博客文章添加到页面中,并且仅了解SimplePie才能完成此任务。

Question 1 - If I update the site from .html to .php is there a hit in SEO while the Search Engines re-index? 问题1-如果我将网站从.html更新为.php,那么在搜索引擎重新编制索引的同时,搜索引擎优化是否会受到影响?

Question 2 - Is there a way to use Server Side Includes to include a .php file of my SimplePie results, or another way to pull blog posts directly into a .html file? 问题2-有没有一种方法可以使用Server Side Includes包含我的SimplePie结果的.php文件,还是有另一种方法可以将博客文章直接拉入.html文件?

I'd appreciate advice. 我将不胜感激建议。

For question 1 - no, not necessarily. 对于问题1-不,不一定。 You can use apache's mod_rewrite to process the old HTML pages as php scripts, and you don't need to change URLs. 您可以使用apache的mod_rewrite将旧的HTML页面作为php脚本进行处理,而无需更改URL。 For question 2, it depends how your simplepie results are loaded, but PHP can include another file fairly easily. 对于问题2,这取决于您的simplepie结果如何加载,但是PHP可以相当容易地包含另一个文件。 Can you provide more detail about the file being included? 您能否提供有关所包含文件的更多详细信息?

Find this line in your httpd.conf file 在您的httpd.conf文件中找到此行

AddType application/x-httpd-php .php .php3 .phtml

Then add .html to it, also some systems require each addtype to be on a different line but I forget why. 然后将.html添加到其中,有些系统还要求每个addtype在不同的行上,但我忘记了为什么。

AddType application/x-httpd-php .php .php3 .phtml .html

Now all your .html files will be parsed as php and you can use standard php includes for results.php. 现在,您所有的.html文件都将被解析为php,并且您可以对results.php使用标准的php include。

you'll take a performance hit but probably not to bad. 您会受到性能上的打击,但可能还不错。 you might want to try a client side approach unless you need search engines to pick up what your pulling in with simplepie. 您可能要尝试一种客户端方法,除非您需要搜索引擎来利用simplepie获取您的建议。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM