我想将http://localhost/test/a/1
重定向为http://localhost/test/a/index.php?para=1
在a文件夹下的.htaccess应该怎么写?

解决方案 »

  1.   

    csdn没人啊?怎么问问题老没人答啊!
      

  2.   


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

  3.   

    .htaccess:
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^([0-9]+)$ index\.php\?para=$1 [L]
    报400错误
    Bad RequestYour browser sent a request that this server could not understand.
      

  4.   

    RewriteRule ^([0-9]+)$ /index\.php\?para=$1
    这样直接进localhost界面了
    RewriteRule ^([0-9]+)$ http\:\//\localhost\/\test\/\a\/\index\.php\?para=$1
    这样写是可以的
    但写全路径也太那个了
      

  5.   

    另外参数是类似“1-0-Our-Christmas-tree-Decorated--11947011582464000”这样的,不是纯数字
      

  6.   

    不写全路径就出错
    报400错误
    Bad RequestYour browser sent a request that this server could not understand.
      

  7.   

    我用了[R],发现路径居然是http://localhost/E:/test/a/index.php?para=1-0-Our-Christmas-tree-Decorated--11947011582464000
      

  8.   

    好了,原因是根目录没定义好,所以一直爬到外面去了,在test/下面添加个.htaccess
      

  9.   

    RewriteRule ((http[s?]:\/\/)?.*)\/([\d|\w|-]+)  $1\/index.php?para=$3
    试一下。这个我没有试哦。出了啥错,记得告诉我一下啊。