0

我想改变

/index.php?do=/pages/

/index.html?do=/pages/

我的代码不起作用

      RewriteCond %{THE_REQUEST} ^[A-Z]+\s([^\s]+)\.php?do=\s
      RewriteRule .* %1.html [R=301,L]
      RewriteRule ^(.*)\.html$ $1.php
4

1 回答 1

0

你可以这样做:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_URI} ^/([A-Za-z0-9_-.]*).php?do=(.*)
    RewriteRule .* /%1.html?do=%2 [R=301,L]
</IfModule>

这应该匹配

everything.php?do=anything

将其重写为

everything.html?do=anything
于 2013-01-11T20:34:13.620 回答