在.htaccess中重写规则旁边的QSA标志中,$_GET参数为空


Empty $_GET params altough QSA flag next to rewrite rule in .htaccess

我尝试过stackoverflow上发布的各种解决方案,但似乎都不起作用。

我真的很想知道我现在在这里错过了什么。htaccess看起来像这样:

RewriteEngine On
RewriteRule ^register/?$ ./register.php?reference=$1 [L,QSA]

我得到的URL是这样的:

domain.com/register/ENIGMA-45

这一切都很好,但$_GET参数没有通过。

我已经尝试过print_r($_GET)print($_SERVER['QUERY_STRING]);都是空的。

VirtualHost config:
<VirtualHost 199.99.99.99:82>
    ServerName dot.magicaldomain.com
    ServerAlias www.dot.magicaldomain.com
    DocumentRoot /home/dot/public_html
    ServerAdmin webmaster@dot.magicaldomain.com
    ## User dot # Needed for Cpanel::ApacheConf
    <IfModule mod_userdir.c>
        Userdir disabled
        Userdir enabled dot 
    </IfModule>
    <IfModule mod_suphp.c>
        suPHP_UserGroup dot dot
    </IfModule>
    <IfModule !mod_disable_suexec.c>
        <IfModule !mod_ruid2.c>
           SuexecUserGroup dot dot
        </IfModule>
    </IfModule>
    <IfModule mod_ruid2.c>
       RUidGid dot dot
    </IfModule>
    CustomLog /usr/local/apache/domlogs/dot.magicaldomain.com-bytes_log "%{%s}t %I .'n%{%s}t %O ."
    CustomLog /usr/local/apache/domlogs/dot.magicaldomain.com combined
    Options -ExecCGI -Includes
    RemoveHandler cgi-script .cgi .pl .plx .ppl .perl
</VirtualHost>

捕获:

domain.com/register/ENIGMA-45

你可以使用这个:

Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteRule ^register/?([^/]*|)/?$ /register.php?reference=$1 [L]

将此添加到您的virtualhost:

<Directory "/home/dot/public_html">
    Options -Indexes FollowSymLinks +ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>