问题原文
原帖链接 · Kyle Postlewait · CC BY-SA 3.0
I've been running my company's website, which uses the same header, footer and left column on every page, since late 2014. Because of this I set up the Apache server to interpret HTML documents as if they were PHP. I am using include() to bring the header.html, footer.html, and leftcolumn.html into each page, with some other minor variable exchanges, etc.
Now I'm working on my own website and was going to make the same move, but saw other questions on here being told to not force HTML to be read as PHP (in PHP form creation answers, which I successfully implemented, without forcing).
Question: Is it bad practice to configure a server to parse HTML files as PHP? Are there possible SEO repercussions for doing so? Should I forgo file extensions altogether and move into a folder structure? (.com/players/ instead of .com/players.html)
As there doesn't seem to be a clear answer on similar questions, this may be considered a "discussion" type question; if so I will turn on forcing HTML to PHP as it seems the easiest option for me, and consider rebuilding into a folder structure.
已采纳解答
原帖链接 · John Conde · CC BY-SA 3.0
Is it bad practice to force html to be read as php? Are there possible SEO repercussions for doing so?
Search engines don't know nor care about how your pages are generated. They only see the output the request URL provides (in other words the output of your PHP file).
Should I forgo file extensions altogether and move into a folder structure? ( .com/players/ instead of .com/players.html)
Cool URIs don't change. It doesn't matter if you have a file extension or not, and if you do use one, it doesn't change when you change technologies. So choose whatever you think will be easiest for you to manage and stick with it.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
