dongleman4760 2013-09-02 23:08
浏览 51
已采纳

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

I've tried various solutions posted here on stackoverflow, none of them seemed to work.

I really wonder what am I missing here, currently .htaccess looks like this:

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

I'm getting URL like this:

domain.com/register/ENIGMA-45

That's all good, but $_GET param don't pass.

I've tried to print_r($_GET) and print($_SERVER['QUERY_STRING]); both are empty.

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 .
%{%s}t %O ."
    CustomLog /usr/local/apache/domlogs/dot.magicaldomain.com combined
    Options -ExecCGI -Includes
    RemoveHandler cgi-script .cgi .pl .plx .ppl .perl
</VirtualHost>
  • 写回答

1条回答 默认 最新

  • dousi8237 2013-09-02 23:13
    关注

    To capture:

    domain.com/register/ENIGMA-45
    

    You can use this:

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

    Add this to your virtualhost:

    <Directory "/home/dot/public_html">
        Options -Indexes FollowSymLinks +ExecCGI
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?