Jump to content

[SOLVED] Upgrade to Apache2.0 no longer matches url part


davedave_au

Recommended Posts

Hi,

 

Last night I upgraded a Win2K server to run Apache 2.0.59 from 1.3

 

The problem is that the application running uses slashes instead of question marks and ampersands in the query string, without the use of mod_rewrite.

A usual URL would be http://servername/path/script.php/key1/value1/key2/value2/keyN/valueN

 

Apache 1.3 used to match "http://servername/path/script.php" and then the php application used the full URL ($_SERVER['PATH_INFO']) to reconstruct the query variables. I know this also works by default with Apache 2.2.4 on Linux.

 

I cannot remember if I did anything special when I set up 1.3 on Win2K originally as it was about 5 years ago, but the configuration doesn't seem to show anything special.

 

Any help would be greatly appreciated.

 

Cheers,

Dave

 

 

Since no one has an answer, I've decided to solve it with mod_rewrite.

 

Here's what I added to each virtual host

 

RewriteEngine On

RewriteRule ^(.*)\.php\/([^/]*)\/(.*)$ $1.php/$2=$3

RewriteRule ^(.*)\.php\/([^/]*)\/(.*)$ $1.php/$2&$3 [N]

RewriteRule ^(.*)\.php\/(.*)$ $1.php?$2 [L]

 

 

Explained:

1) Turn on the rewrite engine

2) If there's a slash immediately after the .php then replace the next slash with an equals sign.

3) If there's a slash immediately after the .php then replace the next slash with an ampersand. [N] means repeat from the start of the rewrites (until it doesn't match).

4) If there's a slash immediately after the .php then replace that slash with a ?

 

Problem solved.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.