rewrite到:http://www.test.com/template/index.php?id=0123456789
---------------------------------------------------------------
RewriteRule ^([0-9]+)$ template/index.php?id=$1另外rewrite到: http://www.test.com/template.php?id=0123456789
--------------------------------------------------------------
RewriteRule ^([0-9]+)$ template.php?id=$1是在httpd.conf中插入配置代码还是在.htaccess中,请尽量说的详细些,谢谢!
----------------------------------------------------------------------
都行

解决方案 »

  1.   

    是不是在httpd.conf中插入配置代码或是在站点根目录下生成.htaccess文件都可以实现rewrite?除了RewriteRule ^([0-9]+)$ template.php?id=$1这行代码还有其他的要加的代码吗
      

  2.   

    编译Apache时把mod_rewrite编译成模块,httpd.conf中有LoadModule rewrite_module libexec/mod_rewrite.so,并且在Addmodule中有Addmodule mod_rewrite.c如要使用.htaccess,添加:
    Options Indexes FollowSymLinks 
    AllowOverride all
      

  3.   

    RewriteEngine on
    RewriteRule ^([0-9]+)$ template/index.php?id=$1