1
我想重写URL,以便它们在Apache中没有index.php。目前为止一切正常,但我需要在GET请求中发送查询字符串参数,并意识到它们正在被剥离。我正在使用QSA标志,但它不工作,我的查询字符串永远不会到达服务器。Apache重写规则删除查询字符串
<VirtualHost noomo.jp:443>
DocumentRoot /var/www/noomo-web/public
<Directory "/var/www/noomo-web/public">
AllowOverride All
Options -Multiviews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L,QSA]
</Directory>
SSLCertificateFile /etc/letsencrypt/live/noomo.jp/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/noomo.jp/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
ServerName noomo.jp
</VirtualHost>
我是否缺少传递查询字符串所需的内容?我已经遍寻谷歌,但我能找到的只是基于查询字符串重定向,而不是确保查询字符串通过。我以前在nginx服务器上发生过同样的事情,但我不知道如何在Apache上修复它。
你还可以添加R标志('[L,QSA,R]'),并检查你的规则的确切结果是什么? –
我添加了R标志,但它没有任何区别,查询字符串仍然消失,我用一个只支持查询字符串的一次性PHP脚本对其进行了测试。但是,如果我确实将index.php部分添加到URL中,它就可以正常工作。我在重写中正在做什么剥离查询字符串? – DarthCoder