.htaccess内容:PHP code    RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !^/index.php RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ [NC] RewriteRule ^submit.html$ submit.php RewriteRule ^submit_pad.html$ submit_pad.php RewriteRule ^search.html$ search.php RewriteRule ^index.html$ index.php RewriteRule ^search-([\w]+)\.html$ search.php?keyword=$1 RewriteRule ^search-([\w]+)_([\d]+)\.html$ search.php?keyword=$1&page=$2 RewriteRule ^([\w\d-]+)-category\.html$ category.php?alias=$1 RewriteRule ^([\w\d-]+)-category_([\d]+)\.html$ category.php?alias=$1&page=$2 RewriteRule ^([\w\d-]+)/([\w\d-]+)\.html$ pad.php?alias=$2
我用.htaccess重写URL,在本地服务器测试一点问题都没有。
但放到网上服务器上却出现了问题。
凡是链接到submit.html,search.html这样的链接都没有问题,
可是链接到audio-category.html,search-a.html这样带参数的链接都被重置到了index页面。
弄了半天也没有搞定,
网上的地址是http://softatoz.net/
请高手帮忙解答!谢谢!
另外:
RewriteRule ^([\w\d-]+)-category\.html$ category.php?alias=$1
RewriteRule ^([\w\d-]+)-category_([\d]+)\.html$ category.php?alias=$1&page=$2
这两行能不能写成一行?怎么写?第二行是处理分页的。
如果说的不明白,我再作解释!

解决方案 »

  1.   

    .htaccess内容:RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !^/index.php
    RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$  [NC]RewriteRule ^submit.html$ submit.php
    RewriteRule ^submit_pad.html$ submit_pad.php
    RewriteRule ^search.html$ search.phpRewriteRule ^index.html$ index.phpRewriteRule ^search-([\w]+)\.html$ search.php?keyword=$1
    RewriteRule ^search-([\w]+)_([\d]+)\.html$ search.php?keyword=$1&page=$2RewriteRule ^([\w\d-]+)-category\.html$ category.php?alias=$1
    RewriteRule ^([\w\d-]+)-category_([\d]+)\.html$ category.php?alias=$1&page=$2RewriteRule ^([\w\d-]+)/([\w\d-]+)\.html$ pad.php?alias=$2
      

  2.   

    呵呵,URL重写真的是蛮烦的,建议好好看一下RewriteRule的写法。
    这次,别人告诉你怎么写了,你还是不会。这个没有什么技巧的。