分享

写回答

发帖

[提问] 求助 win主机运行PHP 伪静态 .htaccess 转 web.config

GoDaddy GoDaddy 2984 人阅读 | 18 人回复

发表于 2011-6-1 22:51:44 | 显示全部楼层 |阅读模式

win主机  谁能帮我啊,谢谢
htaccess




RewriteEngine On
RewriteBase /


# duoduo Rewrite规则
RewriteRule index\.html$ /index\.php
RewriteRule sitemap\.html$ /sitemap\.php
RewriteRule malllist\.html$ /malllist\.php
RewriteRule shoplist\.html$ /shoplist\.php
RewriteRule article\.html$ /article\.php
RewriteRule user/center\.html$ /user/center\.php
RewriteRule mall-(.*)\.html$ /mall\.php\?id=$1
RewriteRule view-(.*)-(.*)\.html$ /view\.php\?iid=$1&page=$2
RewriteRule view-(.*)\.html$ /view\.php\?iid=$1
RewriteRule malllist-(.*)-(.*)-(.*)\.html$ /malllist\.php\?catid=$1&mall=$2&page=$3
RewriteRule article_list-(.*)-(.*)\.html$ /article_list\.php\?cid=$1&page=$2
RewriteRule article_list-(.*)\.html$ /article_list\.php\?cid=$1
RewriteRule read-(.*)\.html$ /read\.php\?id=$1
RewriteRule list-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)\.html$ /list\.php\?cid=$1&start_price=$2&end_price=$3&sort=$4&area=$5&guarantee=$6&list=$7&q=$8&page=$9
RewriteRule shop-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)\.html$ /shop\.php\?nick=$1&start_price=$2&end_price=$3&sort=$4&area=$5&guarantee=$6&list=$7&q=$8&page=$9
RewriteRule shoplist-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)\.html$ /shoplist\.php\?cid=$1&keyword=$2&startlevel=$3&endlevel=$4&area=$5&px=$6&page=$7
RewriteRule shoplist-(.*)\.html$ /shoplist\.php\?cid=$1
RewriteRule shop-(.*)\.html$ /shop\.php\?nick=$1
RewriteRule list-(.*)\.html$ /list\.php\?cid=$1
RewriteRule list\.html$ /list\.php

[ 本帖最后由 763639 于 2011-6-1 10:52 PM 编辑 ]

回答|共 18 个

cryz

发表于 2011-6-1 22:54:36 | 显示全部楼层

<rewrite>
  <rules>
    <rule name="Imported Rule 1">
      <match url="index\.html$" ignoreCase="false" />
      <action type="Rewrite" url="/index\.php" />
    </rule>
    <rule name="Imported Rule 2">
      <match url="sitemap\.html$" ignoreCase="false" />
      <action type="Rewrite" url="/sitemap\.php" />
    </rule>
    <rule name="Imported Rule 3">
      <match url="malllist\.html$" ignoreCase="false" />
      <action type="Rewrite" url="/malllist\.php" />
    </rule>
    <rule name="Imported Rule 4">
      <match url="shoplist\.html$" ignoreCase="false" />
      <action type="Rewrite" url="/shoplist\.php" />
    </rule>
    <rule name="Imported Rule 5">
      <match url="article\.html$" ignoreCase="false" />
      <action type="Rewrite" url="/article\.php" />
    </rule>
    <rule name="Imported Rule 6">
      <match url="user/center\.html$" ignoreCase="false" />
      <action type="Rewrite" url="/user/center\.php" />
    </rule>
    <rule name="Imported Rule 7">
      <match url="mall-(.*)\.html$" ignoreCase="false" />
      <action type="Rewrite" url="/mall\.php\?id={R:1}" appendQueryString="false" />
    </rule>
    <rule name="Imported Rule 8">
      <match url="view-(.*)-(.*)\.html$" ignoreCase="false" />
      <action type="Rewrite" url="/view\.php\?iid={R:1}&amp;page={R:2}" appendQueryString="false" />
    </rule>
    <rule name="Imported Rule 9">
      <match url="view-(.*)\.html$" ignoreCase="false" />
      <action type="Rewrite" url="/view\.php\?iid={R:1}" appendQueryString="false" />
    </rule>
    <rule name="Imported Rule 10">
      <match url="malllist-(.*)-(.*)-(.*)\.html$" ignoreCase="false" />
      <action type="Rewrite" url="/malllist\.php\?catid={R:1}&amp;mall={R:2}&amp;page={R:3}" appendQueryString="false" />
    </rule>
    <rule name="Imported Rule 11">
      <match url="article_list-(.*)-(.*)\.html$" ignoreCase="false" />
      <action type="Rewrite" url="/article_list\.php\?cid={R:1}&amp;page={R:2}" appendQueryString="false" />
    </rule>
    <rule name="Imported Rule 12">
      <match url="article_list-(.*)\.html$" ignoreCase="false" />
      <action type="Rewrite" url="/article_list\.php\?cid={R:1}" appendQueryString="false" />
    </rule>
    <rule name="Imported Rule 13">
      <match url="read-(.*)\.html$" ignoreCase="false" />
      <action type="Rewrite" url="/read\.php\?id={R:1}" appendQueryString="false" />
    </rule>
    <rule name="Imported Rule 14">
      <match url="list-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)\.html$" ignoreCase="false" />
      <action type="Rewrite" url="/list\.php\?cid={R:1}&amp;start_price={R:2}&amp;end_price={R:3}&amp;sort={R:4}&amp;area={R:5}&amp;guarantee={R:6}&amp;list={R:7}&amp;q={R:8}&amp;page={R:9}" appendQueryString="false" />
    </rule>
    <rule name="Imported Rule 15">
      <match url="shop-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)\.html$" ignoreCase="false" />
      <action type="Rewrite" url="/shop\.php\?nick={R:1}&amp;start_price={R:2}&amp;end_price={R:3}&amp;sort={R:4}&amp;area={R:5}&amp;guarantee={R:6}&amp;list={R:7}&amp;q={R:8}&amp;page={R:9}" appendQueryString="false" />
    </rule>
    <rule name="Imported Rule 16">
      <match url="shoplist-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)\.html$" ignoreCase="false" />
      <action type="Rewrite" url="/shoplist\.php\?cid={R:1}&amp;keyword={R:2}&amp;startlevel={R:3}&amp;endlevel={R:4}&amp;area={R:5}&amp;px={R:6}&amp;page={R:7}" appendQueryString="false" />
    </rule>
    <rule name="Imported Rule 17">
      <match url="shoplist-(.*)\.html$" ignoreCase="false" />
      <action type="Rewrite" url="/shoplist\.php\?cid={R:1}" appendQueryString="false" />
    </rule>
    <rule name="Imported Rule 18">
      <match url="shop-(.*)\.html$" ignoreCase="false" />
      <action type="Rewrite" url="/shop\.php\?nick={R:1}" appendQueryString="false" />
    </rule>
    <rule name="Imported Rule 19">
      <match url="list-(.*)\.html$" ignoreCase="false" />
      <action type="Rewrite" url="/list\.php\?cid={R:1}" appendQueryString="false" />
    </rule>
    <rule name="Imported Rule 20">
      <match url="list\.html$" ignoreCase="false" />
      <action type="Rewrite" url="/list\.php" />
    </rule>
  </rules>
</rewrite>
回复 支持 反对

使用道具 举报

763639

发表于 2011-6-1 23:40:30 | 显示全部楼层

谢谢 我试下
回复 支持 反对

使用道具 举报

lwbo1987

发表于 2011-6-2 10:22:20 | 显示全部楼层

回复 3# 的帖子

测试可以吗?
回复 支持 反对

使用道具 举报

763639

发表于 2011-6-2 17:35:22 | 显示全部楼层

不行, 求助能帮解决下
回复 支持 反对

使用道具 举报

cryz

发表于 2011-6-2 17:38:35 | 显示全部楼层

看下哪条不行,或者全不行?
回复 支持 反对

使用道具 举报

763639

发表于 2011-6-2 17:43:46 | 显示全部楼层

程序商又提供了了我一个   HTTPD.INI
说要空间商加载




[ISAPI_Rewrite]

# 3600 = 1 hour
CacheClockRate 3600

RepeatLimit 32

# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP

# duoduo Rewrite规则
RewriteRule ^/index\.html$ /index\.php
RewriteRule ^/sitemap\.html$ /sitemap\.php
RewriteRule ^/malllist\.html$ /malllist\.php
RewriteRule ^/shoplist\.html$ /shoplist\.php
RewriteRule ^/article\.html$ /article\.php
RewriteRule ^/user/center\.html$ /user/center\.php
RewriteRule ^/mall-(.*)\.html$ /mall\.php\?id=$1
RewriteRule ^/view-(.*)-(.*)\.html$ /view\.php\?iid=$1&page=$2
RewriteRule ^/view-(.*)\.html$ /view\.php\?iid=$1
RewriteRule ^/malllist-(.*)-(.*)-(.*)\.html$ /malllist\.php\?catid=$1&mall=$2&page=$3
RewriteRule ^/article_list-(.*)-(.*)\.html$ /article_list\.php\?cid=$1&page=$2
RewriteRule ^/article_list-(.*)\.html$ /article_list\.php\?cid=$1
RewriteRule ^/read-(.*)\.html$ /read\.php\?id=$1
RewriteRule ^/list-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)\.html$ /list\.php\?cid=$1&start_price=$2&end_price=$3&sort=$4&area=$5&guarantee=$6&list=$7&q=$8&page=$9
RewriteRule ^/shop-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)\.html$ /shop\.php\?nick=$1&start_price=$2&end_price=$3&sort=$4&area=$5&guarantee=$6&list=$7&q=$8&page=$9
RewriteRule ^/shoplist-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)\.html$ /shoplist\.php\?cid=$1&keyword=$2&startlevel=$3&endlevel=$4&area=$5&px=$6&page=$7
RewriteRule ^/shoplist-(.*)\.html$ /shoplist\.php\?cid=$1
RewriteRule ^/shop-(.*)\.html$ /shop\.php\?nick=$1
RewriteRule ^/list-(.*)\.html$ /list\.php\?cid=$1
RewriteRule ^/list\.html$ /list\.php
回复 支持 反对

使用道具 举报

cryz

发表于 2011-6-2 17:45:17 | 显示全部楼层

godaddy 不支持ISAPI_REWRITE,搜到的,仅供参考
回复 支持 反对

使用道具 举报

763639

发表于 2011-6-2 17:45:31 | 显示全部楼层

源程序伪静态文件是放在空间子目录 /Rewrite/下
回复 支持 反对

使用道具 举报

763639

发表于 2011-6-2 17:46:35 | 显示全部楼层

原帖由 cryz 于 2011-6-2 05:45 PM 发表
godaddy 不支持ISAPI_REWRITE,搜到的,仅供参考



那这也行不通
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则