Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Apache htaccess Rewrite

Posted on 2010-11-21
11
Medium Priority
?
662 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting http://domain.com (http://domain.com) to http…
Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses
Course of the Month12 days, 4 hours left to enroll

636 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