htaccess在特殊情况下不起作用


htaccess is not working in an special case

我正在进行htaccess URL重写分配。我的实际URL是

blabla.comqid=1&qtitle=what-is-css

我已经像一样使用htaccess编写了它

blabla.com/1/what-is-css

现在我添加了另一个查询字符串用于共享,新的URL必须像一样

blabla.com/1/what-is-css?share=asadas_45asd_asdasd-4744

我当前的htaccess代码低于

RewriteEngine On
RewriteRule ^([-0-9a-zA-Z]+)/([-0-9a-zA-Z]+)/?$ index.html?question=$1&qtitle=$2
RewriteRule ^([-0-9a-zA-Z]+)/?$ index.html?question=$1

所以基本上有三个可选的查询字符串,其中两个应该重写,一个不会重写。

对于记录(除了我上面的评论):

RewriteEngine On
RewriteRule ^([-0-9a-zA-Z]+)/([-0-9a-zA-Z]+)/?$ index.html?question=$1&qtitle=$2 [QSA]
RewriteRule ^([-0-9a-zA-Z]+)/?$ index.html?question=$1