1
manuel
Use REQUEST_URI instead of PHP_SELF generally? (Core problem)
  • 2004/5/3 8:48

  • manuel

  • Just popping in

  • Posts: 3

  • Since: 2004/2/25


Hi!

I've have a problem with a solution (also others too as this thread shows)

The problem is that in some places withing XOOPS (I'm using 2.0.6) that the global PHP_SELF variable is used to create urls (forms,navigation,etc) and configured sites like mine (an maybe more users) that uses apache .htaccess with modrewrite configured to handle multiple domains with only one account.

Let me show my configuration for more clearness:

I own 1 hosting solution that I will call myhost.com, and I also have pointing to this host a couple of more domains.
So domain1.com and domain2.com -> points to myhost.com.
But thanks to modrewrite I change the url for every domainX to a subdirectory withing myhost.com htdocs
I have XOOPS installed in each subdirectory (and, of course, visible from http://domain1.com and http://domain2.com)-

Here is my .htaccess:

Quote:

RewriteEngine On
Options +FollowSymlinks
RewriteBase /
RewriteCond %{HTTP_HOST} domain1.com
RewriteCond %{REQUEST_URI} !domain1_com/
RewriteRule ^(.*)$ domain1_com/$1 [L]
RewriteCond %{HTTP_HOST} domain2.com
RewriteCond %{REQUEST_URI} !domain2_com/
RewriteRule ^(.*)$ domain2_com/$1 [L]


That causes to php self to pointo to /domain1_com/index.php but it's needed to point to /index.php.

I changed a couple of scripts from XOOPS (see above forum link), eg: /class/pagenav.php, to use some code like this:
Quote:

$submit_page = $HTTP_SERVER_VARS['REQUEST_URI'];
if(strpos($submit_page,"?")) $submit_page = substr($submit_page,0,strpos($submit_page,"?"));

instead of
Quote:

$submit_page = $HTTP_SERVER_VARS['PHP_SELF']


Am I wrong and should learn more about url rewriting or should change XOOPS developers to use the request uri (without get params) instead of php_self?

2
ludoo
Re: Use REQUEST_URI instead of PHP_SELF generally? (Core problem)
  • 2007/5/29 13:10

  • ludoo

  • Just popping in

  • Posts: 4

  • Since: 2005/3/7 1


got the same problem if XOOPS is in sub-directory like mydomain.com/xoops

I use this :
$submit_page $_SERVER['PHP_SELF'];
        
$pos strpos($submit_page,"/modules/");
        if(
$pos>=0$submit_page "/xoops".substr($submit_page,$pos);


Base on "/modules" detection, if coming from rewriting, i had
"/xoops" or not (i know "/xoops" is hardcoded ;-( , but i prefer waiting for an official patch/upgrade)

LudoO

Login

Who's Online

256 user(s) are online (183 user(s) are browsing Support Forums)


Members: 0


Guests: 256


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits