PHP网站转换为静态HTML网站 - 链接问题 [英] PHP Website Converted to Static HTML site - Linking Issue

查看:180
本文介绍了PHP网站转换为静态HTML网站 - 链接问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个动态PHP网站,我需要转换成静态的网站给到客户端。我用的的wget 拉文件,它也正是我需要的。之前,唯一的问题is..my链接(那些在谷歌索引)没有文件扩展名。我用的.htaccess摆脱PHP文件扩展名。

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.

所以,我的URL看起来像这样的: http://www.domain.com/about/

So one of my URL's would look like this: http://www.domain.com/about/

当我得到了一个静态版本的网站,它改变了我的所有环节为.html

When I got a static version of the website, it changed all of my links to .html

这可能是好的,因为我可以使用htaccess的摆脱那个文件扩展名的,因此我所有的链接将和以前一样。嗯,在每一页的内部链接被链接到的.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.

是否与htaccess的办法来引导用户,如果他们去about.html它会带他们去有关不带扩展名?所以我所有的内联仍然可以工作?

或者是有你们可能提出的任何其他建议如何处理?

Or is there any other suggestions you guys might have on how to handle this?

下面是wget的code我用:

Here is the wget code I use:

wget -k -K  -E -r -l 10 -p -N -F -nH http://www.domain.com/

我怎样可以得到输出.php文件,而不是HTML吗?

How can I get that to output .php files instead of .html?

谢谢!

推荐答案

您可以添加到您的.htaccess:

You can add this to your .htaccess:

RewriteRule ^([^\.]+)$ $1.html [NC,L]

摘自:<一href="http://www.sicanstudios.com/how-to-remove-php-html-htm-extensions-with-htaccess/">http://www.sicanstudios.com/how-to-remove-php-html-htm-extensions-with-htaccess/

这篇关于PHP网站转换为静态HTML网站 - 链接问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆