0

我正在尝试将带有变量的 php 链接转换为 html 链接(例如在 SMF 上),以便增加我网站的 seo,

我的链接是这样的:

http://site.com/pages/page1.php?v1=var1&v2=var2&v3=var3&v4=var4

或者:

http://site.com/pages/?v1=var1&v2=var2&v3=var3&v4=var4

我需要它看起来像这样:

http://site.com/pages/page1.var1.var2.var3.var4.html

或者

http://site.com/pages/var1.var2.var3.var4.html

或者

http://site.com/page.php/var1,var2.var3.var4.html

SMF 论坛中的链接:

http://forum.com/index.php/topic,9197.0.html

如何做到这一点并且alos能够获取这些变量值?

4

3 回答 3

4

您只需要学习如何实现 URL 重写。我知道 PHP 在 IIS 中的 Windows 上运行,但我将继续假设您可能正在运行 Apache。只需阅读使用.htaccess文件和 mod_rewrite 进行重定向。还有一些类似的东西(唉,你必须付费),称为 Windows 服务器的 ISAPI Rewrite,我已经用过很多次了。如果您不想使用第三方插件并且您拥有服务器 2008,那么 IIS 的向导会做得相当不错,他们只是直接修改您的 web.config 文件来进行重定向。

于 2012-10-27T16:15:54.630 回答
0

您可能想尝试研究有关 URL 编码的信息,如果您想更改链接显示 url 的方式,我知道这就是...希望我的回答就足够了 :)

http://www.jaywebtechnologies.co.cc

于 2012-10-27T16:12:51.693 回答
0

我看到您的问题已经解决(对于 Linux)。如果有人对 Windows Server 有同样的问题,您可以使用 Ionics ISAPI Rewrite Filter

http://iirf.codeplex.com/

I've been using it for years now, and it works perfectly. Just wanted to post it here in case anybody needs it.

于 2013-04-12T14:23:44.263 回答