Solved

Apache htaccess Rewrite

Posted on 2010-11-21
11
653 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ProxyPass - Problem 5 223
setup wamp server for first time 2 102
Need To Change Centos 6 Timestamp Form In Log File 24 117
More Than One Website On Same DMZ Server 3 93
Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

733 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