本帖最后由 daisy8675 于 2009-09-19 10:29:11 编辑

解决方案 »

  1.   

    RewriteRule ^(.+)\.html$ /error404.php?url=$1
      

  2.   

    http://www.test.com/test/test.html
    这样的也被写了,只写根目录的*.html
      

  3.   

    RewriteRule ^(.+)\.html$ /error404.php?url=$1无效,测试完毕!
    百度,Google都找半天都还只是那几个网页,换了一下顺序而已。
    有没有详细的重写规则的CHM格式的书呢?
      

  4.   

    <IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteBase / 
    RewriteRule ^?(.*)\.html$ /more.php?url=$1 [L] 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^?(.*)$ /error404.php?url=$1 [L] 
    </IfModule> 看看这个行不行,没时间帮你试.
      

  5.   

    <IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteBase / 
    RewriteRule ^/?(.*)\.html$ /test.php?url=$1 [L] 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ /error404.php?url=$1 [L] 
    </IfModule> 我实验了没有问题啊.都在第一条规则那边跳到test.php
      

  6.   

    谢谢,是真不行!
    这样http://test.com/test/test.html也被重写到test.php了。
    要求只写根目录下的*.html
      

  7.   

    原来是这个意思啊?晕死
    <IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteBase / 
    RewriteRule ^([^/]+)\.html$ /test.php?url=$1 [L] 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ /test.php?url=error [L] 
    </IfModule> 
    就是说不要让url有斜杠,而且是以.html 结尾的不就行了嘛.....
      

  8.   

    正解,但还有一个小问题存在,就是根目录也被重写了。
    比如:http://www.test.com输入后打开的肯定是http://www.test.com/
    这里就有一个/了,所以根目录也被重写了。
    还是一个问题!
      

  9.   

    同意11楼的 另外你说的http://www.test.com 打开后成为http://www.test.com/ 这个是正常的 不是被重写的,你随便输入一个网址http://www.163.com 都会变成http://www.163.com/。
    因为你已经RewriteBase /了 /下边没有匹配上的将不会被重写的
      

  10.   

    楼主试试这个
    <IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteRule ^/?([^/]+)\.html$ /test.php?url=$1 [L]
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^/?(.*)$ /error404.php?url=$1 [L] 
    </IfModule>