服务器端包含 - php
我正在更新一个当前为静态 html 的网站(即index.html)。我想将博客文章拉入页面,并且只知道 SimplePie 可以完成此操作。
问题 1 - 如果我将网站从 .html 更新为 .php,当搜索引擎重新索引时,SEO 是否会受到影响?
问题 2 - 有没有办法使用服务器端包含来包含我的 SimplePie 结果的 .php 文件,或者有其他方法将博客文章直接提取到 .html 文件中?
我很感激建议。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对于问题 1 - 不,不一定。您可以使用apache的mod_rewrite将旧的HTML页面作为php脚本进行处理,并且不需要更改URL。对于问题 2,这取决于您的 simplepie 结果的加载方式,但 PHP 可以相当轻松地包含另一个文件。您能否提供有关所包含文件的更多详细信息?
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?
在 httpd.conf 文件中找到这一行
AddType application/x-httpd-php .php .php3 .phtml
然后添加 .html 到其中,也有些系统要求每个 addtype 位于不同的行上,但是我忘了为什么。
AddType application/x-httpd-php .php .php3 .phtml .html
现在您的所有 .html 文件都将被解析为 php,您可以使用标准 php 包含 results.php。
你的性能会受到影响,但可能还不错。您可能想尝试客户端方法,除非您需要搜索引擎来获取您使用 simplepie 提取的内容。
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.