httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <outbo...@centrum.cz>
Subject [users@httpd] mod_rewrite's behaviour changes while upgrading Apache1 -> 2
Date Fri, 03 Sep 2004 07:32:30 GMT
Hello,

I would like to upgrade Apache1 (13.29)  to Apache2 (2.0.50) but an exact behaviour of mod_rewrite
have changed.

We're rewriting URL (hiding php page and variables)

How this zone is defined first:

<VirtualHost 1.2.3.4>
        ServerAdmin webmaster@domain.com
        ServerName www.domain.com
        ServerAlias domain.com *.domain.com
        RewriteEngine On
        RewriteCond  %{HTTP_HOST} !^www
        RewriteCond  %{HTTP_HOST} ^([^.]+)
        RewriteCond  %{DOCUMENT_ROOT}/%1 -d
        RewriteRule  ^/(.*) %{DOCUMENT_ROOT}/%1/$1
        RewriteCond  %{HTTP_HOST}  ^www\.ceadvisor\.cz
        RewriteRule  ^/page_(.*)_(.*)\.html$ http://www.domain.com/index.php?page=$1&service=$2
[L,QSA]
        DocumentRoot /domains/domain.com/
        ErrorLog logs/domain.com.error.log
        TransferLog logs/domain.com.transfer.log
        ErrorDocument   404     /404.php
</VirtualHost>

First set of Conds and the first rule should point subdomain into folders (easy and working)
The last Cond & Rule is the rule to hide php pages with 2 variables into a fake html page
(to get better crawler positioning etc.)

Behaviour of Apache1:
Everything is fine and working, when I run www.domain.com/page_zviditelneni_1.html  ->
the correct index.php?page=zviditelneni&service=1  is called and there's www.domain.com/page_zviditelneni_1.html
in the URL line of my browser. That's how it should work

Behaviour of Apache2:
Unfortunately apache2 is doing it wrong. It calls good page, BUT send 302 REDIRECT code and
redirect user to that php page. So, the problem is that user see index.php?page=zviditelneni&service=1
in his URL row instead of  www.domain.com/page_zviditelneni_1.html.

Check log for details :-/

62.240.183.1 - - [29/Aug/2004:22:39:28 +0200] [www.domain.com/sid#81c9450][rid#84758c8/initial]
(2) init rewrite eng
ine with requested uri /page_zviditelneni_1.html
62.240.183.1 - - [29/Aug/2004:22:39:28 +0200] [www.domain.com/sid#81c9450][rid#84758c8/initial]
(3) applying pattern
 '^/(.*)' to uri '/page_zviditelneni_1.html'
62.240.183.1 - - [29/Aug/2004:22:39:28 +0200] [www.domain.com/sid#81c9450][rid#84758c8/initial]
(4) RewriteCond: inp
ut='www.domain.com' pattern='!^www' => not-matched
62.240.183.1 - - [29/Aug/2004:22:39:28 +0200] [www.domain.com/sid#81c9450][rid#84758c8/initial]
(3) applying pattern
 '^/page_(.*)_(.*)\.html$' to uri '/page_zviditelneni_1.html'
62.240.183.1 - - [29/Aug/2004:22:39:28 +0200] [www.domain.com/sid#81c9450][rid#84758c8/initial]
(4) RewriteCond: inp
ut='www.domain.com' pattern='^www\.ceadvisor\.cz' => matched
62.240.183.1 - - [29/Aug/2004:22:39:28 +0200] [www.domain.com/sid#81c9450][rid#84758c8/initial]
(2) rewrite /page_zv
iditelneni_1.html -> http://www.domain.com/index.php?page=zviditelneni&sluzba=1
62.240.183.1 - - [29/Aug/2004:22:39:28 +0200] [www.domain.com/sid#81c9450][rid#84758c8/initial]
(3) split uri=http:/
/www.domain.com/index.php?page=zviditelneni&sluzba=1 -> uri=http://www.domain.com/index.php,
args=page=zviditelnen
i&sluzba=1
62.240.183.1 - - [29/Aug/2004:22:39:28 +0200] [www.domain.com/sid#81c9450][rid#84758c8/initial]
(2) implicitly forci
ng redirect (rc=302) with http://www.domain.com/index.php
62.240.183.1 - - [29/Aug/2004:22:39:28 +0200] [www.domain.com/sid#81c9450][rid#84758c8/initial]
(1) escaping http://
www.domain.com/index.php for redirect
62.240.183.1 - - [29/Aug/2004:22:39:28 +0200] [www.domain.com/sid#81c9450][rid#84758c8/initial]
(1) redirect to http
://www.domain.com/index.php?page=zviditelneni&sluzba=1 [REDIRECT/302]

Could anybody help please?

Best regards,

Roman






---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message