Results 1 to 7 of 7

php's $_SERVER-array is empty if I am using vBSEO - how can I get these values?

This is a discussion on php's $_SERVER-array is empty if I am using vBSEO - how can I get these values? within the Troubleshooting forums, part of the vBSEO SEO Plugin category; I tried to insert a new plugin in the "global_start"-hook-location in vBulletin and inserted the following code: PHP Code: echo  ...

  1. #1
    Member
    Real Name
    Andy
    Join Date
    May 2008
    Location
    Germany
    Posts
    42
    Liked
    0 times

    php's $_SERVER-array is empty if I am using vBSEO - how can I get these values?

    I tried to insert a new plugin in the "global_start"-hook-location in vBulletin and inserted the following code:
    PHP Code:
    echo $_SERVER['REQUEST_URI']; 
    This works fine if I am opening the forum startpage in my browser - I can see the current url displayed as first line of my website.
    But if I am trying to get the $_SERVER['REQUEST_URI'] value on forumdisplay-pages or member-pages, the whole $_SERVER-array seems to be empty. I guess that this is an vBSEO-issue because the problems appears on all pages that have a "virtual" subfolder (/memberlist, /members, /forumname etc).
    Can you tell me how I can get the current url or other values from PHP's $_SERVER-array on these pages? I also tried to use PHP's getenv()-function but this also returns empty strings.

  2. #2
    Senior Member briansol's Avatar
    Real Name
    Brian
    Join Date
    Apr 2006
    Location
    Central CT, USA
    Posts
    6,981
    Liked
    8 times
    try
    $_SERVER['SCRIPT_NAME']

  3. #3
    Member
    Real Name
    Andy
    Join Date
    May 2008
    Location
    Germany
    Posts
    42
    Liked
    0 times
    Like I said:
    - $_SERVER['REQUEST_URI'] is empty
    - $_SERVER is empty
    - print_r($_SERVER) returns an empty array
    - and this also implies that $_SERVER['SCRIPT_NAME'] is empty...

  4. #4
    Senior Member briansol's Avatar
    Real Name
    Brian
    Join Date
    Apr 2006
    Location
    Central CT, USA
    Posts
    6,981
    Liked
    8 times
    i think it's a hook location problem.

    i can't get it to print in global-start, but it prints fine on forumhome complete

  5. #5
    Member
    Real Name
    Andy
    Join Date
    May 2008
    Location
    Germany
    Posts
    42
    Liked
    0 times
    Do you actually read what I am writing? I already wrote in my first post that it is working fine on forumhome. The only problem is that $_SERVER is empty on pages with a virtual "subdirectory" inserted by vBSEO:
    /members/blah.html
    /members/list/blubb.html
    /forumname/threadname.html
    etc.
    And it is not a problem with the global_start hook-location because I know for sure that globa_start is being executed on every vbulletin page. If i write
    echo "test";
    into the global_start-plugin instead of
    echo $SERVER['whatever']
    the string "test" appears on every vbulletin page, even the "vbSEOed" pages. The only issue is that the $SERVER-array is empty on vbSEOed pages whose URLs contain a virtual subdirectory.

  6. #6
    Member
    Real Name
    Andy
    Join Date
    May 2008
    Location
    Germany
    Posts
    42
    Liked
    0 times
    I was able to solve the problem. vbSEO offers a global constant called VBSEO_REQURL_FULL and this constant also contains the full url including all parameters.

  7. #7
    Member
    Real Name
    Bill Belcamino
    Join Date
    Nov 2008
    Posts
    33
    Liked
    0 times
    try $_SERVER['VBSEO_URI']

Similar Threads

  1. Need Some index.php's removed
    By navjotjsingh in forum Custom Rewrite Rules
    Replies: 3
    Last Post: 11-07-2007, 09:54 PM
  2. Replies: 1
    Last Post: 10-05-2007, 02:05 AM
  3. Replies: 3
    Last Post: 02-28-2007, 03:49 PM
  4. New install -- Question about default values
    By KW802 in forum URL Rewrite Settings
    Replies: 26
    Last Post: 01-05-2007, 06:09 PM
  5. Replies: 2
    Last Post: 08-11-2005, 07:22 PM

Posting Permissions

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