使用 .htaccess 放在要重写的目录。一般放到网站根目录。

解决方案 »

  1.   

    例如:
    编辑一个.htaccess文件
    内容:
    LoadModule rewrite_module
    RewriteEngine on 
    RewriteRule /xxtx/([0-9]*).html /xxtx/a.php\?a=$1保存至根目录下

    http://localhost/xxtx/123.html
    rewrite为
    http://localhost/xxtx/a.php?a=123
      

  2.   

    为什么我把.htaccess文件放到根目录下不行
    而写到httpd.conf中就可以
      

  3.   

    可能你http.conf文件中不允许使用.htaccess文件来修改apache的配置
      

  4.   

    看看httpd.conf的该目录下的allowOverRide是否为all
      

  5.   

    设置
    <Directory />
        Options FollowSymLinks
        AllowOverride all
    </Directory>
    还不行呀
    为什么呀
      

  6.   

    <Directory />
        Options FollowSymLinks
        AllowOverride all
    </Directory>windows吗?还是写物理路径吧
    linux写成/var/www/html这种形式
      

  7.   

    .htaccess这样写试试
    LoadModule rewrite_module
    RewriteEngine   On
    RewriteBase     /
    RewriteRule     /xxtx/([0-9]*).html /xxtx/a.php\?a=$1