URLRewrite的问题

2016-07-07 15:12 来源:www.chinab4c.com 作者:ecshop专家

我的服务器上本来就有一个.htaccess文件,,我试过把他换成EC的,,就出现网站无法浏览,把EC的.htaccess的内容复制过去也不行,,空间自带的.htaccess里面的内容如下..请帮我看看,,谢.下面代码做了点掩饰

# -FrontPage-

#Options None

<Limit GET POST PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName youname.com
AuthUserFile /www/users/......
AuthGroupFile /www/users/.....


回答:
您试试把我们的附加到最后面看看。

如果不行的话,也别着急,我们再准备出一个放到 httpd.conf 的 rewrite 版本,应该是放到 2.1.2 版本。

rewrite太浪费资源

原帖由 zgxiangdu 于 2006-11-18 23:05 发表
rewrite太浪费资源


用.htaccess会降低性能;把下面这个放到 httpd.conf 里就可以用了

<IfModule mod_rewrite.c>

RewriteEngine On

# direct one-word access
RewriteRule ^(.*)/category$$1/index.php[L]
RewriteRule ^(.*)/feed.xml$$1/feed.php[L]

# access any object by its numeric identifier
RewriteRule ^(.*)/category-([0-9]+)\.html$ $1/category.php?id=$2[QSA,L]
RewriteRule ^(.*)/category-([0-9]+)-(.*)\.html$$1/category.php?id=$2[QSA,L]

RewriteRule ^(.*)/category-([0-9]+)-([0-9]+)\.html$ $1/category.php?id=$2&page=$3[QSA,L]
RewriteRule ^(.*)/category-([0-9]+)-([0-9]+)-(.*)\.html$$1/category.php?id=$2&page=$3[QSA,L]

RewriteRule ^(.*)/category-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)\.html$$1/category.php?id=$2&page=$3&sort=$4&order=$5 [QSA,L]
RewriteRule ^(.*)/category-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)-(.*)\.html$ $1/category.php?id=$2&page=$3&sort=$4&order=$5 [QSA,L]

RewriteRule ^(.*)/goods-([0-9]+)\.html$ $1/goods.php?id=$2 [QSA,L]
RewriteRule ^(.*)/goods-([0-9]+)-(.*)\.html$$1/goods.php?id=$2 [QSA,L]

RewriteRule ^(.*)/article_cat-([0-9]+)\.html$$1/article_cat.php?id=$2[QSA,L]
RewriteRule ^(.*)/article_cat-([0-9]+)-(.*)\.html$$1/article_cat.php?id=$2[QSA,L]

RewriteRule ^(.*)/article_cat-([0-9]+)-([0-9]+)\.html$ $1/article_cat.php?id=$2&page=$3[QSA,L]
RewriteRule ^(.*)/article_cat-([0-9]+)-([0-9]+)-(.*)\.html$$1/article_cat.php?id=$2&page=$3[QSA,L]

RewriteRule ^(.*)/article_cat-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)\.html$$1/article_cat.php?id=$2&page=$3&sort=$4&order=$5[QSA,L]
RewriteRule ^(.*)/article_cat-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)-(.*)\.html$ $1/article_cat.php?id=$2&page=$3&sort=$4&order=$5[QSA,L]

RewriteRule ^(.*)/article-([0-9]+)\.html$$1/article.php?id=$2[QSA,L]
RewriteRule ^(.*)/article-([0-9]+)-(.*)\.html$$1/article.php?id=$2[QSA,L]

RewriteRule ^(.*)/search-b([0-9]+)\.html$1/search.php?brand=$2 [QSA,L]
RewriteRule ^(.*)/search-b([0-9]+)-(.*)\.html $1/search.php?brand=$2 [QSA,L]

</IfModule>

eccom
放到httpd.conf
还是不能用,是什么原因呢?



应该做一些小修改:以下是我测试成功的规则,直接点击下方的复制代码即可使用
  1. <IfModule mod_rewrite.c>
  2. RewriteEngine On
  3. RewriteRule /feed-c([0-9]+)\.xml$ /feed\.php\?cat=$1
  4. RewriteRule /feed-b([0-9]+)\.xml$ /feed\.php\?brand=$1
  5. RewriteRule /feed\.xml$/feed\.php
  6. RewriteRule /category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$/category\.php\?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5&page=$6&sort=$7&order=$8
  7. RewriteRule /category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)(.*)\.html$ /category\.php\?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5
  8. RewriteRule /category-([0-9]+)-b([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$/category\.php\?id=$1&brand=$2&page=$3&sort=$4&order=$5
  9. RewriteRule /category-([0-9]+)-b([0-9]+)-([0-9]+)(.*)\.html$ /category\.php\?id=$1&brand=$2&page=$3
  10. RewriteRule /category-([0-9]+)-b([0-9]+)(.*)\.html$ /category\.php\?id=$1&brand=$2
  11. RewriteRule /category-([0-9]+)(.*)\.html$ /category\.php\?id=$1
  12. RewriteRule /goods-([0-9]+)(.*)\.html$ /goods\.php\?id=$1
  13. RewriteRule /article_cat-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$/article_cat\.php\?id=$1&page=$2&sort=$3&order=$4
  14. RewriteRule /article_cat-([0-9]+)-([0-9]+)(.*)\.html$ /article_cat\.php\?id=$1&page=$2
  15. RewriteRule /article_cat-([0-9]+)(.*)\.html$ /article_cat\.php\?id=$1
  16. RewriteRule /article-([0-9]+)(.*)\.html$ /article\.php\?id=$1
  17. RewriteRule /brand-([0-9]+)-c([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)\.html/brand\.php\?id=$1&cat=$2&page=$3&sort=$4&order=$5
  18. RewriteRule /brand-([0-9]+)-c([0-9]+)-([0-9]+)(.*)\.html /brand\.php\?id=$1&cat=$2&page=$3
  19. RewriteRule /brand-([0-9]+)-c([0-9]+)(.*)\.html /brand\.php\?id=$1&cat=$2
  20. RewriteRule /brand-([0-9]+)(.*)\.html /brand\.php\?id=$1
  21. RewriteRule /tag-(.*)\.html /search\.php\?keywords=$1
  22. RewriteRule /snatch-([0-9]+)\.html$ /snatch\.php\?id=$1
  23. RewriteRule /group_buy-([0-9]+)\.html$ /group_buy\.php\?act=view&id=$1
  24. RewriteRule /auction-([0-9]+)\.html$ /auction\.php\?act=view&id=$1
  25. RewriteRule /exchange-id([0-9]+)(.*)\.html$ /exchange\.php\?id=$1&act=view
  26. RewriteRule /exchange-([0-9]+)-min([0-9]+)-max([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$/exchange\.php\?cat_id=$1&integral_min=$2&integral_max=$3&page=$4&sort=$5&order=$6
  27. RewriteRule /exchange-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$/exchange\.php\?cat_id=$1&page=$2&sort=$3&order=$4
  28. RewriteRule /exchange-([0-9]+)-([0-9]+)(.*)\.html$ /exchange\.php\?cat_id=$1&page=$2
  29. RewriteRule /exchange-([0-9]+)(.*)\.html$ /exchange\.php\?cat_id=$1
  30. </IfModule>
复制代码
原文见我的博客:http://www.086php.com/index.php/ecshop_urlrewrite/303

可以使用啊