Forum Moderators: phranque

Message Too Old, No Replies

Reading RewriteLog information

Issue with values not being recognized correctly after RewriteRule

         

Maschenka

7:36 am on Aug 6, 2004 (gmt 0)



I have recently started with mod_rewrite in order to make my pages more friendly towards search engines. First of all: When uploaded to my ISP everything works fine.

But when I try using it at home (WAMP installation, Windows, Apache, MySQL, PHP) I run into problems as the values I have assigned to parameters are not read properly if there is more than one value.

Example:

=== .htaccess ===
RewriteEngine on
RewriteRule ^album/(.*)/(.*)/$ /album.php?cat=$1&album=$2

In principle then
[192.168.1.100...] should be interpreted as
[192.168.1.100...]

Instead I get an error message, and if I ask for an output of the parameters with
print_r($_GET);
the result is
Array ( [cat] => ealbum/e/4/album=4 )

I have activated RewriteLog, and this is the important bit of the log (added line breaks for better readability):


add path-info postfix: c:/programme/wamp/homepages/album
-> c:/programme/wamp/homepages/album/e/4/
strip per-dir prefix: c:/programme/wamp/homepages/album/e/4/
-> album/e/4/
applying pattern '^album/(.*)/(.*)/$' to uri 'album/e/4/'
rewrite album/e/4/
-> /test.php?cat=ealbum/e/4/album=4
split uri=/test.php?cat=ealbum/e/4/album=4
-> uri=/test.php, args=cat=ealbum/e/4/album=4
add path-info postfix: /test.php
-> /test.php/e/4/

Can anybody here help me with the interpretation of why it goes wrong?

jdMorgan

1:58 am on Aug 7, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Maschenka,

Welcome to WebmasterWorld [webmasterworld.com]!

This is very strange.

Only two things come to mind:

First, are you sure that the code you posted has been uploaded to your server?

Second, you may (somehow) have a corrupted module on your server. I'd suggest you try re-loading it.

I'd also recommend changing your rule to the following, which will be faster. But what you already have should work, this is just a speed-up:


RewriteRule ^album/([^/]+)/([^/]+)/$ /album.php?cat=$1&album=$2 [L]

Jim

Maschenka

6:09 am on Aug 7, 2004 (gmt 0)



Good morning!

First, are you sure that the code you posted has been uploaded to your server?

I am not sure how to understand this question. At home I am working directly on my web server, so there is no need for uploading anything. And I know I am changing things in the right directory, because a) I can see the date and time of the last change and b) I can see the effects when I change file contents.

Second, you may (somehow) have a corrupted module on your server. I'd suggest you try re-loading it.

Ok, I have commented the corresponding line out in my httpd.conf, restarted Apache, put the line in again, restarted Apache. That is currently the only thing I can do as I didn't find the right DLL for download in order to exchange the old one, and my knowledge is not big enough to compile my own from the source code.

RewriteRule ^album/([^/]+)/([^/]+)/$ /album.php?cat=$1&album=$2 [L]

Thanks for the hint, I will have a look at the syntax after breakfast.