Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    After trying to make virtual subdomains with mod_rewriting


    After trying to make virtual subdomains with mod_rewriting for phpbb multiforums script
    Any variables are not being passed at all to php scripts, e.g profile.php does not see any variables, admin/index.php and so on...
    Register Global, arrays, argv all set on.

    Some technical details

    .htaccess on root folder
    RewriteEngine on
    ReWriteCond %{HTTP_HOST} !^$
    ReWriteCond %{HTTP_HOST} !www\.talkorchat\.com
    ReWriteCond %{HTTP_HOST} (.*)\.talkorchat\.com
    ReWriteRule (.*) seo.php?multiusername=%1


    Seo.php
    <?php
    //$multiusername = $_SERVER['REQUEST_URI'];
    //$multiusername = "zzz";
    echo "seo mode ".$mode;
    define("MFORUM", $multiusername);

    include('multiconfig.php');
    include('config.php');

    $file = $_SERVER['REQUEST_URI'];
    $file = "/".$multiusername.$_SERVER['REQUEST_URI'];
    //echo " URI $file";

    if($script_path)
    {
    $slash = '/';
    }
    // /phppbb/zzz/
    $replace = $slash.$script_path.'/'.MFORUM.'/';

    //$replace = "/".$multiusername."/";


    …………………

    profile.php

    if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )

    {
    $mode = ( isset($HTTP_GET_VARS['mode']) ) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode'];
    $mode = htmlspecialchars($mode);

    if ( $mode == 'viewprofile' )



    ………………

    testing with normal URL http://talkorchat.com/zzz.php?mode=ok
    it is ok QUERY STRING is set and zzz.php script response with $mode=ok

    PHP VariablesVariable Value
    PHP_SELF /zzz.php
    _REQUEST["mode"] ok
    _GET["mode"] ok
    _SERVER["AuthDigestEnableQueryStringHack"] On
    _SERVER["SCRIPT_URL"] /zzz.php
    _SERVER["SCRIPT_URI"] http://talkorchat.com/zzz.php
    _SERVER["HTTP_USER_AGENT"] Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; en) Opera 9.01
    _SERVER["HTTP_HOST"] talkorchat.com
    _SERVER["HTTP_ACCEPT"] text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1
    _SERVER["HTTP_ACCEPT_LANGUAGE"] ru,en;q=0.9
    _SERVER["HTTP_ACCEPT_CHARSET"] iso-8859-1, utf-8, utf-16, *;q=0.1
    _SERVER["HTTP_ACCEPT_ENCODING"] deflate, gzip, x-gzip, identity, *;q=0
    _SERVER["HTTP_CACHE_CONTROL"] no-cache
    _SERVER["HTTP_CONNECTION"] Keep-Alive, TE
    _SERVER["HTTP_TE"] deflate, gzip, chunked, identity, trailers
    _SERVER["PATH"] C:\Perl\bin\;C:\server\xampp\perl\bin\;c:\server\x ampp\imagic;C:\WINDOWS\system32;C:\WINDOWS;C:\WIND OWS\System32\Wbem
    _SERVER["SystemRoot"] C:\WINDOWS
    _SERVER["COMSPEC"] C:\WINDOWS\system32\cmd.exe
    _SERVER["PATHEXT"] .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
    _SERVER["WINDIR"] C:\WINDOWS
    _SERVER["SERVER_SIGNATURE"] <address>Apache/2.2.2 (Win32) DAV/2 mod_ssl/2.2.2 OpenSSL/0.9.8b mod_autoindex_color PHP/5.1.4 Server at talkorchat.com Port 80</address>
    _SERVER["SERVER_SOFTWARE"] Apache/2.2.2 (Win32) DAV/2 mod_ssl/2.2.2 OpenSSL/0.9.8b mod_autoindex_color PHP/5.1.4
    _SERVER["SERVER_NAME"] talkorchat.com
    _SERVER["SERVER_ADDR"] 62.141.48.86
    _SERVER["SERVER_PORT"] 80
    _SERVER["REMOTE_ADDR"] 87.119.168.66
    _SERVER["DOCUMENT_ROOT"] C:/aweb/talkorchat.com/
    _SERVER["SERVER_ADMIN"] admin@localhost
    _SERVER["SCRIPT_FILENAME"] C:/aweb/talkorchat.com/zzz.php
    _SERVER["REMOTE_PORT"] 61357
    _SERVER["GATEWAY_INTERFACE"] CGI/1.1
    _SERVER["SERVER_PROTOCOL"] HTTP/1.1
    _SERVER["REQUEST_METHOD"] GET
    _SERVER["QUERY_STRING"] mode=ok
    _SERVER["REQUEST_URI"] /zzz.php?mode=ok
    _SERVER["SCRIPT_NAME"] /zzz.php
    _SERVER["PHP_SELF"] /zzz.php
    _SERVER["REQUEST_TIME"] 1157924913
    _SERVER["argv"] Array
    _SERVER["argc"] 1




    http://zzz.talkorchat.com/zzz.php?mode=ok
    PHP Variables
    Variable Value
    PHP_SELF /seo.php
    _REQUEST["multiusername"] zzz
    _REQUEST["ok"] yes
    _REQUEST["ViewCookie"] true
    _REQUEST["ForumSetCookie"] xxx
    _REQUEST["phpbb_aaa_data"] a:2:{s:11:\"autologinid\";s:32:\"12473402644ff4b2f af6179.33242983\";s:6:\"userid\";i:2;}
    _REQUEST["phpbb_xxx_data"] a:2:{s:11:\"autologinid\";s:0:\"\";s:6:\"userid\"; i:-1;}
    _REQUEST["phpbb2mysql_data"] a:2:{s:11:\"autologinid\";s:0:\"\";s:6:\"userid\"; i:-1;}
    _GET["multiusername"] zzz
    _GET["ok"] yes
    _COOKIE["ViewCookie"] true
    _COOKIE["ForumSetCookie"] xxx
    _COOKIE["phpbb_aaa_data"] a:2:{s:11:\"autologinid\";s:32:\"12473402644ff4b2f af6179.33242983\";s:6:\"userid\";i:2;}
    _COOKIE["phpbb_xxx_data"] a:2:{s:11:\"autologinid\";s:0:\"\";s:6:\"userid\"; i:-1;}
    _COOKIE["phpbb2mysql_data"] a:2:{s:11:\"autologinid\";s:0:\"\";s:6:\"userid\"; i:-1;}
    _SERVER["REDIRECT_AuthDigestEnableQueryStringHack"] On
    _SERVER["REDIRECT_STATUS"] 200
    _SERVER["AuthDigestEnableQueryStringHack"] On
    _SERVER["HTTP_ACCEPT"] */*
    _SERVER["HTTP_ACCEPT_LANGUAGE"] en-us
    _SERVER["HTTP_UA_CPU"] x86
    _SERVER["HTTP_ACCEPT_ENCODING"] gzip, deflate
    _SERVER["HTTP_USER_AGENT"] Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322)
    _SERVER["HTTP_HOST"] zzz.talkorchat.com
    _SERVER["HTTP_CONNECTION"] Keep-Alive
    _SERVER["HTTP_COOKIE"] ViewCookie=true; ForumSetCookie=xxx; phpbb_aaa_data=a%3A2%3A%7Bs%3A11%3A%22autologinid% 22%3Bs%3A32%3A%2212473402644ff4b2faf6179.33242983% 22%3Bs%3A6%3A%22userid%22%3Bi%3A2%3B%7D; phpbb_xxx_data=a%3A2%3A%7Bs%3A11%3A%22autologinid% 22%3Bs%3A0%3A%22%22%3Bs%3A6%3A%22userid%22%3Bi%3A-1%3B%7D; phpbb2mysql_data=a%3A2%3A%7Bs%3A11%3A%22autologini d%22%3Bs%3A0%3A%22%22%3Bs%3A6%3A%22userid%22%3Bi%3 A-1%3B%7D
    _SERVER["PATH"] C:\Perl\bin\;C:\server\xampp\perl\bin\;c:\server\x ampp\imagic;C:\WINDOWS\system32;C:\WINDOWS;C:\WIND OWS\System32\Wbem
    _SERVER["SystemRoot"] C:\WINDOWS
    _SERVER["COMSPEC"] C:\WINDOWS\system32\cmd.exe
    _SERVER["PATHEXT"] .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
    _SERVER["WINDIR"] C:\WINDOWS
    _SERVER["SERVER_SIGNATURE"] <address>Apache/2.2.2 (Win32) DAV/2 mod_ssl/2.2.2 OpenSSL/0.9.8b mod_autoindex_color PHP/5.1.4 Server at zzz.talkorchat.com Port 80</address>
    _SERVER["SERVER_SOFTWARE"] Apache/2.2.2 (Win32) DAV/2 mod_ssl/2.2.2 OpenSSL/0.9.8b mod_autoindex_color PHP/5.1.4
    _SERVER["SERVER_NAME"] zzz.talkorchat.com
    _SERVER["SERVER_ADDR"] 62.141.48.86
    _SERVER["SERVER_PORT"] 80
    _SERVER["REMOTE_ADDR"] 62.141.48.86
    _SERVER["DOCUMENT_ROOT"] C:/aweb/talkorchat.com/
    _SERVER["SERVER_ADMIN"] admin@localhost
    _SERVER["SCRIPT_FILENAME"] C:/aweb/talkorchat.com/seo.php
    _SERVER["REMOTE_PORT"] 4907
    _SERVER["REDIRECT_QUERY_STRING"] multiusername=zzz&ok=yes
    _SERVER["REDIRECT_URL"] /zzz.php
    _SERVER["GATEWAY_INTERFACE"] CGI/1.1
    _SERVER["SERVER_PROTOCOL"] HTTP/1.1
    _SERVER["REQUEST_METHOD"] GET
    _SERVER["QUERY_STRING"] multiusername=zzz&ok=yes
    _SERVER["REQUEST_URI"] /zzz.php?mode=ok
    _SERVER["SCRIPT_NAME"] /seo.php
    _SERVER["PHP_SELF"] /seo.php
    _SERVER["REQUEST_TIME"] 1157925274
    _SERVER["argv"] Array
    _SERVER["argc"] 1

    How to solve this problem?

  2. #2
    Try passing the variable through the URL as a string.

  3. #3
    wrong answer
    correct one : adding [QSA] at the end of rewriterule

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •