PHP 网站转换为静态 HTML 网站 - 链接问题
我有一个动态 PHP 网站,我需要将其转换为静态网站以提供给客户。我使用 wget 来提取文件,它完全满足了我的需要。唯一的问题是..我之前的链接(在谷歌中索引的链接)没有文件扩展名。我使用 .htaccess 来去掉 .php 文件扩展名。
所以我的 URL 之一将如下所示: http://www.domain.com/about/
当我获得该网站的静态版本时,它将我的所有链接更改为 .html
这可能没问题,因为我可以使用 htaccess 来获取删除该文件扩展名,因此我的所有链接都将与以前相同。好吧,每个页面中的所有内部链接都链接到 .html 版本。
是否有办法使用 htaccess 来引导用户,如果他们转到 about.html,它会将他们带到没有扩展名的 about ?那么我所有的内部链接仍然有效?
或者你们对于如何处理这个问题还有其他建议吗?
这是我使用的 wget 代码:
wget -k -K -E -r -l 10 -p -N -F -nH http://www.domain.com/
How can I get it to output .php files代替.html?
谢谢!
I had a Dynamic PHP website which I needed to convert into a static website to give to a client. I used wget to pull the files and it did exactly what I needed. The only problem is..my links before (the ones indexed in google) have no file extension. I used .htaccess to get rid of the .php file extension.
So one of my URL's would look like this:
http://www.domain.com/about/
When I got a static version of the website, it changed all of my links to .html
That could be fine, as I could use htaccess to get rid of that file extension and so all of my links will be the same as before. Well, all of the internal linking in each page is linking to the .html version.
Is there a way with htaccess to direct users if they go to about.html it will take them to about with no extension? So all of my internal linking will still work?
Or is there any other suggestions you guys might have on how to handle this?
Here is the wget code I use:
wget -k -K -E -r -l 10 -p -N -F -nH http://www.domain.com/
How can I get that to output .php files instead of .html?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将其添加到您的 .htaccess:
取自: http://www.sicanstudios.com/how-to-remove-php-html-htm-extensions-with-htaccess/
You can add this to your .htaccess:
taken from: http://www.sicanstudios.com/how-to-remove-php-html-htm-extensions-with-htaccess/