You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Graham Frank <gf...@neoservers.com> on 2006/03/28 01:17:31 UTC

[users@httpd] RewriteRule works on 1.3 but not 2.2


Hello all,

I am having a very strange issue with mod_rewrite.

I am in the process of preparing a new web server to production, and I 
have been testing the various scripts and programs we use to verify 
that everything works properly.  My major issue is that a specific 
rewrite rule that works in Apache 1.3 does NOT work in Apache 2.2.

Here's the rule:

RewriteRule ^album/([a-z0-9]*)/category/([0-9-]*)/img/([0-9-]*)/?$   
displayimage.php?album=$1&cat=$2&pos=$3

The rule is used to make a search engine friendly URL that links into 
our content.  A URL that utilizes that rule would be:

http://animegalleries.net/album/toprated/category//img/1

That website uses the Apache 1.3 web server.  In Apache 2.2, that URL 
is not valid due to the //img; however, we need it to work with the 
//img.  It appears that regex in Apache 2.2 is acting quite strangely.

http://208.185.247.66/album/toprated/category//img/1

That's the same website only on the new Apache 2.2 server.  Apache logs 
state that "/album" was not found on the server.  It's ignoring the 
rule.

Can anyone thing of why the rule is not working in Apache 2.2 despite 
it working fine in Apache 1.3?

Thanks!

Server specs:
      AMD Opteron 270
      CentOS 4.3

--Graham


---------------------------------------------------------------------
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


Re: [users@httpd] RewriteRule works on 1.3 but not 2.2

Posted by Robert Ionescu <ro...@googlemail.com>.
Graham Frank wrote:
> RewriteRule ^album/([a-z0-9]*)/category/([0-9-]*)/img/([0-9-]*)/?$   
> displayimage.php?album=$1&cat=$2&pos=$3

Did you check the RewriteLog? So you're using the rule in your 
<directory...> section? Because it is per-dir context (and since you 
have access to httpd.conf, there is no need to use .htaccess files).

The RegEx is not more strict, there is (was?) a normalization on the 
filename level from // to /, so the regEx would match against an input 
string (here the local filepath) not containing a double slash anymore.

-- 
Robert

---------------------------------------------------------------------
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