请问,
我有一个连接 http://localhost/cheyuan/index.php?id=10想要变成 http://localhost/cheyuan/10.html
我的RewriteRule 是
<IfModule mod_rewrite.c>RewriteEngine onRewriteRule ([0-9]+)\.html$ ceshi.php?id=$1 [L]</IfModule>怎么实现不了呢?

解决方案 »

  1.   

    你写反了吧?RewirteRule index.php?id=(\d+)$ $1.html [L]
      

  2.   


    RewriteRule ^([0-9]+).html$ ceshi\.php?id=$1 [L]
      

  3.   

    RewriteRule ^([0-9]+)\.html$ ceshi\.php\?id=$1 [QSA,L]   试试
      

  4.   

    RewriteRule ^([0-9]+)\.html$ ceshi\.php?id=$1 [L]
      

  5.   

    上面三位,我试了,都不行,我的意思是访问http://localhost/cheyuan/index.php?id=1
    出现
    http://localhost/cheyuan/1.html
      

  6.   

    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule ^([0-9]+)\.html$ index\.php?id=$1 [L]
    </IfModule>我的全部代码
      

  7.   

    你是想要301转向,还是apache rewrite?
      

  8.   

    是apache rewrite 的跳转呀,是我的表述有问题吗
      

  9.   

    我的意思就是,访问,http://localhost/cheyuan/index.php?id=1 这个链接,实现伪静态
      

  10.   

    rewrite,你就应该用这个http://localhost/cheyuan/1.html访问相关的页面程序代码index.php里的链接,也要相应的设置成.html,如果针对一些链接设置了rewrite规则根本不是你输入一个.php?……跳转到…….html
      

  11.   

    我这么写在根目录下访问是正常的 RewriteRule ^([0-9]+).html$  /cheyuan/index.php?id=$1  [L]
    (http://localhost/1.html )正常但是 访问 http://localhost/cheyuan/1.html 就不行了
      

  12.   

    RewriteRule ^([0-9]+).html$ index.php?id=$1 [L]