View previous topic :: View next topic |
Author |
Message |
Ermax -
Joined: 03 Sep 2004 Posts: 7
|
Posted: Mon Mar 26, 2007 3:42 pm Post subject: Galley2 URL Rewrite via PATH_INFO |
|
|
I am trying to get URL Rewrite working in Gallery2. I am using the FastCGI interface set to PHP Style and have these settings in my PHP.ini file:
cgi.force_redirect = 0
cgi.fix_pathinfo = 0
Here is the php file that tests if your server can do URL Rewrite via the PATH_INFO method:
Quote: |
<?php
/**
* This is a test file for the PHP Path info Parser. Shows PASS_PATH_INFO on success or
* FAIL_PATH_INFO otherwise.
*
* Usage: index.php/test/path/info
*/
if ($_SERVER['PATH_INFO'] != $_SERVER['SCRIPT_NAME'] &&
$_SERVER['PATH_INFO'] == '/test/path/info') {
print("PASS_PATH_INFO\n");
} else {
print("FAIL_PATH_INFO\n");
}
?>
|
Then to test you just plug a URL like this into you browser:
hxxp://www.blablabla.com/test.php/test/path/info
$_SERVER['PATH_INFO'] should return /test/path/info
and
$_SERVER['SCRIPT_NAME'] should return /test.php
But with Abyss 2.4 it returns /test.php for both.
Is there anyway to make this work? |
|
Back to top |
|
 |
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Mon Mar 26, 2007 9:13 pm Post subject: Re: Galley2 URL Rewrite via PATH_INFO |
|
|
Ermax,
Edit the PHP interpreter declaration in Scripting Parameters and set its type to Standard (instead of PHP Type). _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
 |
Ermax -
Joined: 03 Sep 2004 Posts: 7
|
Posted: Tue Mar 27, 2007 1:45 am Post subject: Re: Galley2 URL Rewrite via PATH_INFO |
|
|
aprelium wrote: | Ermax,
Edit the PHP interpreter declaration in Scripting Parameters and set its type to Standard (instead of PHP Type). |
I have already tried changing cgi.fix_pathinfo to 1 and changing from PHP Style to standard but the test still fails. |
|
Back to top |
|
 |
Ermax -
Joined: 03 Sep 2004 Posts: 7
|
Posted: Tue Mar 27, 2007 3:51 am Post subject: |
|
|
I finally got URL Redirection working for Gallery2 using the PATH_INFO method.
Here is my recipe:
PHP 5.2.1
Abyss X1 2.4
Gallery 2.2.1
Interface: FastCGI (Local - Pipes)
Interpreter: php-cgi.exe
Type: Standard
Php.ini:
cgi.force_redirect = 0
cgi.fix_pathinfo = 1
Then do a global find and replace on your G2 install directory including sub directorys for:
Find 'PATH_INFO' and replace it with 'ORIG_PATH_INFO' (including the single quotes).
As said before PHP doesn't conform to the CGI standard properly and Gallery2 just works around this problem. So when you fix PHP with cgi.fix_pathinfo you break G2.
I noticed that with fix_pathinfo set there is a variable called ORIG_PATH_INFO that is the equivalent of PATH_INFO with fix_pathinfo not set. (well on IIS anyways)
Now that URL rewrite works I was able to get the new (in G2.2) WebDAV mount stuff working on WinXP.
Thanks Aprelium for your help. You talked me into turning fix_pathinfo back on which lead me to this ORIG_PATH_INFO variable. I still don't fully understand why PATH_INFO doesn't work with Abyss with fix_pathinfo set to 0 like it does on other servers.
I hope this helps someone. I know I have been looking for this ability for a long time. When 2.4 came out I was so excited until I realized it didn't directly read the rules in the .htaccess files that G2 creates. |
|
Back to top |
|
 |
Ermax -
Joined: 03 Sep 2004 Posts: 7
|
Posted: Tue Mar 27, 2007 4:32 am Post subject: |
|
|
Well I found another problem.
If you goto a URL like:
www.blablabla.com/phpinfo.php/test+test
PATH_INFO should return /test+test like all other servers do. Instead Abyss escapes the + with %2B. So if you have a album in gallery2 that has a space in the name the link will not work. I guess I am going to have to rig G2 some more to deal with Abyss.
I did a goolge for phpinfo.php add found a bunch of sites. It is kind of handy to test what non Abyss servers return for the PATH_INFO variable by going to these sites with exposed phpinfo.php files. |
|
Back to top |
|
 |
roganty -
Joined: 08 Jun 2004 Posts: 357 Location: Bristol, UK
|
Posted: Wed Mar 28, 2007 11:15 am Post subject: Re: Galley2 URL Rewrite via PATH_INFO |
|
|
Ermax wrote: | aprelium wrote: | Ermax,
Edit the PHP interpreter declaration in Scripting Parameters and set its type to Standard (instead of PHP Type). |
I have already tried changing cgi.fix_pathinfo to 1 and changing from PHP Style to standard but the test still fails. |
Ermax,
When aprelium said to set the PHP interpreter to standard, he was on about in the abyss web console _________________ Anthony R
Roganty | Links-Links.co.uk |
|
Back to top |
|
 |
pkSML -
Joined: 29 May 2006 Posts: 955 Location: Michigan, USA
|
Posted: Thu Mar 29, 2007 11:48 pm Post subject: |
|
|
Ermax wrote: | www.blablabla.com/phpinfo.php/test+test
PATH_INFO should return /test+test like all other servers do. Instead Abyss escapes the + with %2B. So if you have a album in gallery2 that has a space in the name the link will not work. I guess I am going to have to rig G2 some more to deal with Abyss. |
Actually, the %2B is what your browser requests. That's not Abyss. The browser automatically changes those "bad" URL characters into acceptable ones. In PHP, to reverse this process use this:
Code: | <?php $path_info = urldecode($path_info); ?> |
PS You may find this discussion informative, as I had the same question --> http://www.aprelium.com/forum/viewtopic.php?t=9493 _________________ Stephen
Need a LitlURL?
http://CodeBin.yi.org |
|
Back to top |
|
 |
Ermax -
Joined: 03 Sep 2004 Posts: 7
|
Posted: Fri Mar 30, 2007 10:27 pm Post subject: |
|
|
well when I goto say an IIS server and request a page like, phpinfo.php/test+test, PATH_INFO returns /test+test. But when I do the same request with the same browser to an Abyss server PATH_INFO returns /test%2Btest
It realize the browser escapes the + with %2B but it looks like non Abyss servers unescape the %2B back to +. |
|
Back to top |
|
 |
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Mon Apr 02, 2007 5:56 pm Post subject: |
|
|
Ermax,
Oops. Thank you for spotting that. We'll fix it in the next release. If this is urgent, please contact us and we'll send you a fixed version ASAP. _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
 |
Ermax -
Joined: 03 Sep 2004 Posts: 7
|
Posted: Tue Apr 03, 2007 1:20 pm Post subject: |
|
|
aprelium wrote: | Ermax,
Oops. Thank you for spotting that. We'll fix it in the next release. If this is urgent, please contact us and we'll send you a fixed version ASAP. |
Thats ok, it is just my personal webpage. I'll wait for the next release. Thanks a lot for the offer though! |
|
Back to top |
|
 |
|