Server Side Include - php

旧时模样 提交于 2019-12-11 03:05:47

问题


I'm updating a site that is currently static html (i.e. index.html). I'd like to pull in blog posts into the page and only know of SimplePie to accomplish this.

Question 1 - If I update the site from .html to .php is there a hit in SEO while the Search Engines re-index?

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?

I'd appreciate advice.


回答1:


For question 1 - no, not necessarily. You can use apache's mod_rewrite to process the old HTML pages as php scripts, and you don't need to change URLs. For question 2, it depends how your simplepie results are loaded, but PHP can include another file fairly easily. Can you provide more detail about the file being included?




回答2:


Find this line in your httpd.conf file

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.

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.

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.



来源:https://stackoverflow.com/questions/5059763/server-side-include-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!