Php 如何使另一个get变量在友好URL中保持活动状态;。htaccess";?

Php 如何使另一个get变量在友好URL中保持活动状态;。htaccess";?,php,.htaccess,Php,.htaccess,我正在尝试使用.htaccess管理友好的URL,它可以: RewriteEngine on Options -Indexes <FilesMatch ".*\.(phtml)$"> Order Allow,Deny Deny from all </FilesMatch> # if a directory or a file exists, use it directly RewriteCond %{REQUEST_FILENAME} !-f R

我正在尝试使用
.htaccess
管理友好的URL,它可以:

RewriteEngine on

Options -Indexes 

<FilesMatch ".*\.(phtml)$">
    Order Allow,Deny
    Deny from all
</FilesMatch>


# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php
RewriteRule (.*) index.php?q=$1
重新编写引擎打开
选项-索引
命令允许,拒绝
全盘否定
#如果存在目录或文件,请直接使用它
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
#否则将其转发到index.php
重写规则(.*)index.php?q=$1
加载时工作正常
mypage.com/X/Y
;我的PHP脚本将字符串转换为一个数组,使其中的每个元素都是字符串,每个链位于斜杠之间


当我添加一些
GET
vars(例如:
mypage.com/X/Y?var=1
)时,我可以获取相应的值(
var=1
)。如何修复它?

只需将最后一行更改为:

RewriteRule (.*) index.php?q=$1 [QSA]

使用[QSA]标志会导致组合查询字符串。

使用[QSA]时没有任何变化;我在mysite.com/controller/action?var1=test中使用了它,只接受q=controller/action