Solved

Apache htaccess Rewrite

Posted on 2010-11-21
11
646 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
Comment Utility
> 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
Comment Utility
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
Comment Utility
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
 

Author Comment

by:snow4dayz
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:snow4dayz
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Well there is always Git. Thanks anyways.
0
 

Author Closing Comment

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

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
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 …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

743 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now