?
Solved

Apache htaccess Rewrite

Posted on 2010-11-21
11
Medium Priority
?
663 Views
Last Modified: 2012-05-10
Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion'

Alright so I need some help with a mercurial rewrite:

# Taken from http://www.pmwiki.org/wiki/Cookbook/CleanUrls#samedir
# Used at http://ggap.sf.net/hg/
Options +ExecCGI
RewriteEngine On
#write base depending on where the base url lives
RewriteBase /hg
RewriteRule ^$ hgweb.cgi  [L]
# Send requests for files that exist to those files.
RewriteCond %{REQUEST_FILENAME} !-f
# Send requests for directories that exist to those directories.
RewriteCond %{REQUEST_FILENAME} !-d
# Send requests to hgweb.cgi, appending the rest of url.
RewriteRule (.*) hgweb.cgi/$1  [QSA,L]

Open in new window


This must be an infinite loop somehow, any ideas?
0
Comment
Question by:snow4dayz
  • 6
  • 5
11 Comments
 
LVL 43

Expert Comment

by:ravenpl
ID: 34184323
> RewriteRule (.*) hgweb.cgi/$1  [QSA,L]
I understand there is no another handler serving hgweb.cgi as a special handler - right? It's plain CGI?
If so, then hgweb.cgi/$1 does not exist as well as $1 - right? And therefore is processes to hgweb.cgi/hgweb.cgi/$1 and again and again.

You have to break it somewhere,
either You need to pass the extras as cgi variable (url is the variable passed hgweb.cgi)
RewriteRule (.*) hgweb.cgi?url=$1  [QSA,L]

or stopping at hgweb.cgi seen (if hgweb.cgi is a handler)
RewriteCond %{REQUEST_URI} !hgweb\.cgi
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) hgweb.cgi/$1  [QSA,L]
0
 

Author Comment

by:snow4dayz
ID: 34184784
Still yields;

[Sun Nov 21 17:25:21 2010] [client 70.57.173.81] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' t$

# Taken from http://www.pmwiki.org/wiki/Cookbook/CleanUrls#samedir
# Used at http://ggap.sf.net/hg/
Options +ExecCGI
RewriteEngine On
#write base depending on where the base url lives
RewriteBase /hg
RewriteRule ^$ hgweb.cgi  [L]
# Send requests for files that exist to those files.
RewriteCond %{REQUEST_FILENAME} !-f
# Send requests for directories that exist to those directories.
RewriteCond %{REQUEST_FILENAME} !-d
# Send requests to hgweb.cgi, appending the rest of url.
RewriteRule (.*) hgweb.cgi?url=$1  [QSA,L]

Open in new window


Also this does not work at all:

RewriteCond %{REQUEST_URI} !hgweb\.cgi
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) hgweb.cgi/$1  [QSA,L]

Open in new window

0
 
LVL 43

Expert Comment

by:ravenpl
ID: 34185958
Hmm, should not. Can You try enabling Rewrite logging/debugging
http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritelog
And then check the log for rewrite performed actions.

Also, the "RewriteRule ^$ hgweb.cgi  [L]" would be better handled with "DirectoryIndex hgweb.cgi"
0
Granular recovery for Microsoft Exchange

With Veeam Explorer for Microsoft Exchange you can choose the Exchange Servers and restore points you’re interested in, and Veeam Explorer will present the contents of those mailbox stores for browsing, searching and exporting.

 

Author Comment

by:snow4dayz
ID: 34186085
Alright well I forgot to mention it also throws a new error:

(falling back to static-http)

Which that doesnt work either however we need hgweb anyways.


rewrite.log
0
 
LVL 43

Expert Comment

by:ravenpl
ID: 34186181
From the log it looks like "url=$1" works as expected, it finally prints
1.2.3.4 - duke [date] [code.zbuffer.biz/sid#2de8c08][rid#2e63268/initial/redir#1] (1) [per-dir /home/zbuffer/public_html/code/hg/] pass through /home/zbuffer/public_html/code/hg/hgweb.cgi
which means rewrite has done with this.
But it looks like it throws "unauthorized"?

Apart from the above, it looks like Yours original  .htaccess should be fine if You have configured apache with ScriptAlias (or ScriptAliasMatch) in main httpd.conf(or include) - have You?
0
 

Author Comment

by:snow4dayz
ID: 34186199
Yes it is properly configured, yet mercurial still does not work. It fails over to http mode which is VERY slow.
0
 
LVL 43

Expert Comment

by:ravenpl
ID: 34186248
Can You get the rewrite log from original htaccess?
You positive that "ScriptAliasMatch        ^/hg(.*) ..." is in effect(like apache was restarted)
0
 

Author Comment

by:snow4dayz
ID: 34186383
Alright here is the log with my original htaccess. And yes Apache is configured and restarted with the Alias.
rewrite.log
0
 
LVL 43

Expert Comment

by:ravenpl
ID: 34186528
OK, the log shows no infinite loop nor the error You mentioned. I don't think I can help You with that. Sorry.
0
 

Accepted Solution

by:
snow4dayz earned 0 total points
ID: 34186531
Well there is always Git. Thanks anyways.
0
 

Author Closing Comment

by:snow4dayz
ID: 34221176
Decided to go with Git since the experts could not get Mercurial to work for me. :(
0

Featured Post

Free recovery tool for Microsoft Active Directory

Veeam Explorer for Microsoft Active Directory provides fast and reliable object-level recovery for Active Directory from a single-pass, agentless backup or storage snapshot — without the need to restore an entire virtual machine or use third-party tools.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month14 days, 7 hours left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question