QQ 1640076782

2016年08月12日

onepound程序从Linux服务器转到window服务器如何重写伪静态?

Filed under: phper — 标签:, — lijie @ 8:11 上午

我们的程序都是php脚本语言的,一般选择的服务器都是linux+apache+mysql 类型,如果你window服务器支持php语言,有MySQL数据库的

话,也是可以转过去的,但是转过去后不能立即使用,需要重写伪静态。

那么问题来了onepound程序从Linux服务器转到window服务器如何重写伪静态?

1.首先要创建一个web.config文件

2.将下面代码贴进去即可

<?xml version=”1.0″ encoding=”UTF-8″?>

<configuration>

<system.webServer>

<rewrite>

<rules>

<rule name=”Redirect” stopProcessing=”true”>

<match url=”.*” />

<conditions>

<add input=”{HTTP_HOST}” pattern=”^不带www域名$” />

</conditions>

<action type=”Redirect” url=”http://带www域名/{R:0}” redirectType=”Permanent” />

</rule>

<rule name=”Index” stopProcessing=”true”>

<match url=”^index.html” />

<action type=”Rewrite” url=”index.php” />

</rule>

<rule name=”sitemap” stopProcessing=”true”>

<match url=”^sitemap.html” />

<action type=”Rewrite” url=”sitemap.php” />

</rule>

<rule name=”downlist” stopProcessing=”true”>

<match url=”^downlist.html” />

<action type=”Rewrite” url=”downlist.php” />

</rule>

<rule name=”contact_us” stopProcessing=”true”>

<match url=”^contact_us.html” />

<action type=”Rewrite” url=”contact_us.php” />

</rule>

<rule name=”application” stopProcessing=”true”>

<match url=”^application.html” />

<action type=”Rewrite” url=”application.php” />

</rule>

<rule name=”products” stopProcessing=”true”>

<match url=”^products.html” />

<action type=”Rewrite” url=”categories.php” />

</rule>

<rule name=”search” stopProcessing=”true”>

<match url=”^search.html” />

<action type=”Rewrite” url=”advanced_search.php” />

</rule>

<rule name=”results” stopProcessing=”true”>

<match url=”^results.html” />

<action type=”Rewrite” url=”advanced_search_result.php” />

</rule>

<rule name=”product_info” stopProcessing=”true”>

<match url=”^(.*)-p-(.*).html” />

<action type=”Rewrite” url=”product_info.php?products_id={R:2}” />

</rule>

<rule name=”categories” stopProcessing=”true”>

<match url=”^(.*)-c-(.*).html” />

<action type=”Rewrite” url=”categories.php?cPath={R:2}” />

</rule>

<rule name=”topics” stopProcessing=”true”>

<match url=”^(.*)-t-(.*).html” />

<action type=”Rewrite” url=”topics.php?topics_id={R:2}” />

</rule>

<rule name=”article_info” stopProcessing=”true”>

<match url=”^(.*)-a-(.*).html” />

<action type=”Rewrite” url=”article_info.php?articles_id={R:2}” />

</rule>

<rule name=”applicationapp_id” stopProcessing=”true”>

<match url=”^(.*)-app-(.*).html” />

<action type=”Rewrite” url=”application.php?app_id={R:2}” />

</rule>

<rule name=”application_info” stopProcessing=”true”>

<match url=”^(.*)-info-(.*).html” />

<action type=”Rewrite” url=”application_info.php?info_id={R:2}” />

</rule>

<rule name=”inquire” stopProcessing=”true”>

<match url=”^(.*)-inid-(.*).html” />

<action type=”Rewrite” url=”inquire.php?inquire_id={R:2}” />

</rule>

</rules>

</rewrite>

</system.webServer>

</configuration>

将该文档传到网站根目录下,网站立即就可以正常访问了

如果你有建站或google优化需求欢迎联系我们 QQ:点击这里给我发消息