简体   繁体   English

Apache重写规则删除查询字符串

[英]Apache rewrite rule deletes query string

I'm trying to rewrite URLs so that they don't have the index.php in them in Apache. 我正在尝试重写URL,以便他们在Apache中没有index.php。 Everything has been working fine so far, but I needed to send querystring parameters in a GET request and realized they were being stripped off. 到目前为止,一切都运行正常,但我需要在GET请求中发送查询字符串参数,并意识到它们被剥离了。 I'm using the QSA flag, but it's not working and my query string never gets to the server. 我正在使用QSA标志,但它不起作用,我的查询字符串永远不会到达服务器。

<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>

Am I missing something required to pass the query string through? 我错过了传递查询字符串所需的内容吗? I've looked all over Google, but everything I can find just refers to redirecting based on the query string, not making sure that the query string gets through. 我看过谷歌,但我能找到的所有内容都只是指基于查询字符串重定向,而不是确保查询字符串通过。 I've had this same thing happen on an nginx server before, but I don't know how to fix it on Apache. 我之前在nginx服务器上发生了同样的事情,但我不知道如何在Apache上修复它。

Ah! 啊! Found it! 找到了! Alright, I'm gonna answer my own question so people will see this if they Google the same problem, cause this took me hours to realize... Apparently you can't put rewrites inside the entry or they won't work right. 好吧,我要回答我自己的问题所以人们会看到这个,如果他们谷歌同样的问题,因为这花了我几个小时才意识到......显然你不能把重写放在条目中,否则他们将无法正常工作。 I moved the rewrite rules out and put them right inside the entry and it works now. 我将重写规则移出并将它们放在条目中,现在可以正常工作了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM