[UNDER REVIEW] - REQUEST_URI is not recognized by Microsoft IIS 6

Locked
User avatar
evrenyeni
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Fri Dec 23, 2005 1:20 am

[UNDER REVIEW] - REQUEST_URI is not recognized by Microsoft IIS 6

Post by evrenyeni » Fri Dec 23, 2005 1:39 am

In our site, whatever the login module options are; if you login or logout, the browser goes directly to the frontpage.

I made a little research about it and found this reason:

mod_login.php file contains the line
$return = mosGetParam( $_SERVER, 'REQUEST_URI', null );
This is the command for getting back to the referer page after login/logout. Apache servers can run the parameter REQUEST_URI command but Microsoft IIS can not.

We run our site on a Microsoft IIS. Because of this after every login or logout we can't get back to the referer page and we go directly to the frontpage.

Is there any replacement of REQUEST_URI command working on Microsoft IIS or is there anybody knows any solution to fix this problem?

User avatar
evrenyeni
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Fri Dec 23, 2005 1:20 am

[UNDER REVIEW] - REQUEST_URI is not recognized by Microsoft IIS 6

Post by evrenyeni » Sat Dec 24, 2005 1:17 pm

"REQUEST_URI" do not work on Microsoft IIS. Some Joomla files containing this command (for example mod_login.php) can not work properly on IIS. Can anyone find a solution tu run this command on IIS or know any command which substitute "REQUEST_URI".

I think this should be fixed in future versions of joomla.
Last edited by Jinx on Sun Dec 25, 2005 9:38 pm, edited 1 time in total.

User avatar
Jinx
Joomla! Champion
Joomla! Champion
Posts: 6508
Joined: Fri Aug 12, 2005 12:47 am
Contact:

Re: REQUEST_URI is not recognized by Microsoft IIS 6

Post by Jinx » Sun Dec 25, 2005 9:38 pm

There seems to be no easy answer for this problem. Currently found the following blog post on sitepoint : http://www.sitepoint.com/blogs/2005/11/ ... fferences/. I'll try to dig some deeper.
Johan Janssens - Joomla Co-Founder, Lead Developer of Joomla 1.5

http://www.joomlatools.com - Joomla extensions that just work

User avatar
Predator
Joomla! Ace
Joomla! Ace
Posts: 1823
Joined: Wed Aug 17, 2005 10:12 pm
Location: Germany-Bad Abbach
Contact:

Re: [UNDER REVIEW] - REQUEST_URI is not recognized by Microsoft IIS 6

Post by Predator » Mon Dec 26, 2005 3:22 pm

Maybe a small check would help:

Code: Select all

if ( empty( $_SERVER[ 'REQUEST_URI' ] ) ) {         // Not defined by IIS
        // Under some configs, IIS makes SCRIPT_NAME point to php.exe :-(
        if ( !( $_SERVER[ 'REQUEST_URI' ] = @$_SERVER['PHP_SELF'] ) ) {
            $_SERVER[ 'REQUEST_URI' ] = $_SERVER['SCRIPT_NAME'];
        }
        if ( isset( $_SERVER[ 'QUERY_STRING' ] ) ) {
            $_SERVER[ 'REQUEST_URI' ] .= '?' . $_SERVER[ 'QUERY_STRING' ];
        }
    }
The "Humor, Fun and Games" forum has  more than 2500 Posts, so why not build a "Humor, Fun and Games Working" Group?
.....
Malicious tongues say we have this WG right from the start, they call it core team :D

User avatar
evrenyeni
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Fri Dec 23, 2005 1:20 am

Re: [UNDER REVIEW] - REQUEST_URI is not recognized by Microsoft IIS 6

Post by evrenyeni » Mon Dec 26, 2005 4:11 pm

I put this code at the top of the mod_login.php at modules folder, login.php at components folder and index.php at main folder but can't get a result. The browser still goes to the frontpage.

Did I supposed to put the code to any other file?

User avatar
evrenyeni
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Fri Dec 23, 2005 1:20 am

Re: [UNDER REVIEW] - REQUEST_URI is not recognized by Microsoft IIS 6

Post by evrenyeni » Wed Dec 28, 2005 4:35 pm

Some guy in a forum gives me this code to solve the problem:

if(!isset($_SERVER['REQUEST_URI'])) {
$arr = explode("/", $_SERVER['PHP_SELF']);
$_SERVER['REQUEST_URI'] = "/" . $arr[count($arr)-1];
if ($_SERVER['argv'][0]!="")
$_SERVER['REQUEST_URI'] .= "?" . $_SERVER['argv'][0];
}

I simply added this to the top of the mod_ login.php but it did not work out.

I think this code is for a standalone normal PHP operation. But in joomla, things are different. mod_login.php includes this code:

$return = mosGetParam( $_SERVER, 'REQUEST_URI', null );
// converts & to & for xtml compliance
$return = str_replace( '&', '&', $return );

It try to use $_SERVER command by mosGetParam command. If we can entegrate the first code to the second in the way that joomla understands (i.e. after MosGetParam in the correct suffix which I do not know yet), everything will work fine.

Steveyboy
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Thu Jul 26, 2007 1:22 pm

Re: [UNDER REVIEW] - REQUEST_URI is not recognized by Microsoft IIS 6

Post by Steveyboy » Thu Dec 20, 2007 11:02 am

Just came across this problem myself.

thought you'd like to know that i have a hack to fix this.

put this code at the top of your joomla.php file (or anywhere that is loaded before that variable is needed)


  $_SERVER['REQUEST_URI'] = substr($_SERVER['PHP_SELF'],1 ); 
          if (isset($_SERVER['QUERY_STRING'])) { $_SERVER['REQUEST_URI'].='?'.$_SERVER['QUERY_STRING']; }

Many thanks must go to the guy who came up with the code as it wasn't me. but it works perfectly.

User avatar
ianmac
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 4784
Joined: Sat Sep 24, 2005 11:01 pm
Location: Toronto, Canada

Re: [UNDER REVIEW] - REQUEST_URI is not recognized by Microsoft

Post by ianmac » Mon Oct 13, 2008 6:09 am

[quote="Steveyboy"]Just came across this problem myself.

thought you'd like to know that i have a hack to fix this.

put this code at the top of your joomla.php file (or anywhere that is loaded before that variable is needed)


  $_SERVER['REQUEST_URI'] = substr($_SERVER['PHP_SELF'],1 ); 
          if (isset($_SERVER['QUERY_STRING'])) { $_SERVER['REQUEST_URI'].='?'.$_SERVER['QUERY_STRING']; }

Many thanks must go to the guy who came up with the code as it wasn't me. but it works perfectly.[/quote]
In case anybody comes along to this topic in the meantime, please be advised that as of 1.5.1 it is now possible to add a live_site parameter in your configuration.php file so that you can hard code the value in the event that it is not detected properly.

Ian


Locked

Return to “Superseded Issues - Archive”