Rehttpd.ini转成.htaccess有会的大神吗?帮一下
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule /([a-z0-9~%~.~ ] )/index.html /index.php?$1 [I]
RewriteRule /([a-z0-9~%~.~ ] )/index([0-9] ).html /index.php?$1&page=$2 [I]
RewriteRule /([a-z0-9~%~.~ ] )/a.html /index.php?$1/$2 [I]
RewriteRule /([a-z0-9~%~.~ ] )/a([0-9] ).html /index.php?$1/$2 [I]
RewriteRule /([a-z0-9~%~.~ ] )/a([0-9] ).html\?(.*) /index.php?$1/$2&$3 [I]
RewriteRule /([a-z0-9~%~.~ ] )/index.html\?(.*) /index.php?$1&$2 [I]
RewriteRule ^(.*)/u/([0-9] )/(.*)$ /index.php?u&$2&$3 [I]
RewriteRule ^(.*)/u/([0-9] )/(.*)/$ /index.php?u&$2&$3 [I]
RewriteRule ^(.*)/u/([0-9] )$ /index.php?u&$2 [I]
RewriteRule ^(.*)/u/([0-9] )/$ /index.php?u&$2 [I]
RewriteRule /([a-z0-9~%~.~ ] )/index.html?(.*) /index.php?$1&$2 [I]
RewriteRule /([a-z0-9~%~.~ ] )/index([0-9] ).html?(.*) /index.php?$1&page=$2&$2 [I]
</IfModule>
我没有测试,因为你这里多了好多/和\个符号,我给你把我的文件贴出来。你参考一下。
httpd.ini与.htaccess不同的是的.httpd.ini的?号前需加 \ ,
.htacess内容如下:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^index.html$ index.php
RewriteRule ^article-(\d )-(\d ).html$ article.php?id=$2&channel_id=$1
RewriteRule ^news-(\d ).html$ news.php?channel_id=$1
RewriteRule ^news_view-(\d )-(\d ).html$ news_view.php?id=$2&channel_id=$1
RewriteRule ^product-([a-z0-9\-] ).html$ product.php?channel_id=$1
</IfModule>
httpd.ini内容如下:
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
RewriteRule ^/index.html$ /index.php
RewriteRule ^/article-(\d )-(\d ).html$ /article.php\?id=$2&channel_id=$1
RewriteRule ^/news-(\d ).html$ /news.php\?channel_id=$1
RewriteRule ^/news_1-(\d ).html$ /news_1.php\?channel_id=$1
RewriteRule ^/news_view-(\d )-(\d ).html$ /news_view.php\?id=$2&channel_id=$1
RewriteRule ^/product-([a-z0-9\-] ).html$ /product.php\?channel_id=$1
RewriteRule ^/product1-([a-z0-9\-] ).html$ /product1.php\?channel_id=$1
RewriteRule ^/product_show-(\d )-(\d ).html$ /product_show.php\?id=$2&channel_id=$1