0

这是我当前的 htaccess 文件

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/?([^/]+)/(.*) /b.php?n=$1&b=$2 [L,QSA]

这会将我的网址website.com/b.php?n=1&b=1更改为website.com/1/1

我还想将此网址website.com/g/1/1.gif更改为website.com/g/1/1

我怎么能做到这两点?

4

1 回答 1

0

You should be able to add to the with another Rule under the last one.

something like

RewriteRule ([^/]+)?([a-z])/([0-9])/([A-Za-z0-9]*) /$1/$2/$3.gif [L,QSA]

that might need tweak depending on the rest of your urls

You could use a tool like Expresso to make/tweak your regex rules. (http://www.ultrapico.com/Expresso.htm)

于 2012-11-29T11:05:54.923 回答