dongleman4760
dongleman4760
2013-09-02 23:08

在.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 dousi8237 8年前

    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>
    
    点赞 评论 复制链接分享

相关推荐