Solved

Apache htaccess Rewrite

Posted on 2010-11-21
11
651 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
setting up tomcat for external access 4 75
Apache Virtual Hosts in Ubuntu 16.04 ignoring config for non SSL traffic 9 69
maven set up 2 170
htaccess restrict subdomain 4 130
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…
Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
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…

809 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