Java Mailing List Archive

http://www.apache-httpd.com/

Home » users.httpd »

[users@httpd] Internal Recursion with mod_rewrite

Peter Kay

2009-06-29

Replies: Find Java Web Hosting

Author LoginPost Reply

Hello all,

I'm embedding Gallery2 in PmWiki, and trying to get rewrite rules to work for both of the applications. Each has separate rewrite rules, but I'm having trouble combining them...I seem to have a problem with recursive internal redirects, which I don't understand, as every rule uses the [L] command.

The rules are contained in an .htaccess file.

My .htaccess file:


<IfModule mod_rewrite.c>
  RewriteEngine On

  # Send requests without parameters to pmwiki.php.
  RewriteRule ^$       pmwiki.php [L]

  RewriteCond %{REQUEST_FILENAME} -f [OR]
  RewriteCond %{REQUEST_FILENAME} -d [OR]
  RewriteCond %{REQUEST_FILENAME} gallery\_remote2\.php
  RewriteRule .  -  [L]


  RewriteCond %{THE_REQUEST} /Main/Gallery/([^?]+)(\?.|\ .)
  RewriteRule .  /Main/Gallery?g2_path=%1  [QSA,L]
  # Send any other requests to pmwiki.php, appending the query string
part.
  RewriteRule ^([A-Z0-9\xa0-\xff].*)$ pmwiki.php?n=$1 [QSA,L]
</IfModule>

I'm using Apache 2.2 (as a side question - should rewrite rules that work for 2.2 work for other versions?).

The pmwiki requests work fine (so website.net/ works) as do links to any pmwiki stuff (so website.net/Main/Gallery/ pulls up the correct embedding pmwiki request), but...

If I try to go to website.net/Main/Gallery/test1 it doesn't work. I expect it to get rewritten as website.net/Main/Gallery?g2_path=test1 (which does work if I go there directly).

I get a 500 Internal Server Error, and the error_log gives:

 Request exceeded the limit of 10 internal redirects due to probable
 configuration error. Use 'LimitInternalRecursion' to increase the
 limit if necessary. Use 'LogLevel debug' to get a backtrace., referer:
 website.net/Main/Gallery

I'm a bit baffled, as all the rules have [L]. Any ideas?

Thanks,

--Peter Kay


   

---------------------------------------------------------------------
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@(protected)
 "  from the digest: users-digest-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)

©2008 apache-httpd.com - Jax Systems, LLC, U.S.A.