Apache2使用GET参数将所有请求发送到index.php

Apache2使用GET参数将所有请求发送到index.php,apache,Apache,我已经得到了apache的代码。它将所有请求发送到index.php,但我丢失了所有GET参数。如何重写它,这样我就不会丢失参数 <VirtualHost *:80> DocumentRoot /srv/http/framework ServerName framework.localhost RewriteEngine On RewriteCond $1 !^(static) RewriteRule ^/(.*)$ /index.php?pa

我已经得到了apache的代码。它将所有请求发送到index.php,但我丢失了所有GET参数。如何重写它,这样我就不会丢失参数

<VirtualHost *:80>
    DocumentRoot /srv/http/framework
    ServerName framework.localhost
    RewriteEngine On
    RewriteCond $1 !^(static)
    RewriteRule ^/(.*)$ /index.php?page=$1 [PT]
</VirtualHost>

DocumentRoot/srv/http/framework
ServerName framework.localhost
重新启动发动机
1美元^(静态)
重写规则^/(.*)$/index.php?页面=$1[PT]

在/etc/httpd/conf/extra/httpd-vhosts.conf中我已更改

RewriteEngine On
RewriteCond $1 !^(static)
RewriteRule ^/(.*)$ /index.php?page=$1 [PT]
为了


解释一下为什么这比前一个有效:QSA意味着查询字符串追加。默认情况下,重写时会丢弃现有查询字符串并将其替换为新的查询字符串,QSA允许合并现有查询字符串。相反的是QSD(查询字符串丢弃),L标志指示停止进一步执行,但如果在索引中导入一些文件(如css或js),则会出现问题。所有请求都将重定向到相同的index.php
RewriteEngine On
RewriteCond $1 !^(static)
RewriteRule ^/(.*)$ /index.php?page=$1 [L,QSA]