| Author |
|
billo355 Newbie

Joined: 02 April 2009
Online Status: Offline Posts: 8
|
| Posted: 07 December 2011 at 3:47pm | IP Logged
|
|
|
Been using Ape w/ no issues for some time - and just
decided to use it in a new fashion - basically copying
the emulating host header example.
Added this code to the .htaccess
##Fix missing trailing slash char on folders
RewriteCond %{HTTP:Host} (.*)
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !\.
RewriteCond %{REQUEST_URI} !\?
RewriteRule ^(.*) %{REQUEST_URI}/ [R=301,L]
##Map requests to the folders
RewriteCond %{HTTP:Host} (www\.)?(.+)
RewriteRule (.*) /%2$1 [NC,L]
Now if I got to:
www.domainname.com
or
www.domainname.com/test.html
I expect to get the content from
http://www.domainname.com/domainname.com/
and
http://www.domainname.com/domainname.com/test.html
but instead I get an error as I enter an infinite
redirect loop. I turned on logging and confirmed the
loop is occuring.
What am I doing wrong?
|
| Back to Top |
|
| |
Guests Guest

Joined: 01 October 2003
Online Status: Online Posts: -149
|
| Posted: 09 December 2011 at 7:40am | IP Logged
|
|
|
Please, provide rewrite.log for the testing request.
Logging issue described in FAQ
Regards
Andrew
|
| Back to Top |
|
| |
billo355 Newbie

Joined: 02 April 2009
Online Status: Offline Posts: 8
|
| Posted: 11 December 2011 at 8:01pm | IP Logged
|
|
|
Used this code:
RewriteEngine on
RewriteLog "c:\sites\rewrite.log"
RewriteLogLevel 9
##Fix missing trailing slash char on folders
RewriteCond %{HTTP:Host} (.*)
RewriteRule ([^.?]+[^.?/]) http\://%1$1/ [R]
##Map requests to the folders
RewriteCond %{HTTP:Host} (www\.)?(.+)
RewriteRule (.*) /%2$1 [NC,L]
Here is the log (w/ IPs removed and domain name changed.)
The end result w/ an Internal Server Error.
[rid#28379535/initial/2] (5) [perdir c:\program files (x86)\helicon\ape\] strip matching prefix: /searchwithbbb.org -> searchwithbbb.org
[rid#28379535/initial/2] (3) [perdir c:\program files (x86)\helicon\ape\] applying pattern ([^.?]+[^.?/]) to uri searchwithbbb.org
[rid#28379535/initial/2] (4) [perdir c:\program files (x86)\helicon\ape\] RewriteCond: input='www.THEDOMAINNAME.com' pattern='(.*)' => matched
[rid#28379535/initial/2] (2) [perdir c:\program files (x86)\helicon\ape\] escaping http://www.THEDOMAINNAME.comsearchwithbbb/
[rid#28379535/initial/2] (2) [perdir c:\program files (x86)\helicon\ape\] forcing responsecode 302 for http://www.THEDOMAINNAME.comsearchwithbbb/
[rid#28379535/initial/2] (3) [perdir c:\program files (x86)\helicon\ape\] applying pattern (.*) to uri /
[rid#28379535/initial/2] (4) [perdir c:\program files (x86)\helicon\ape\] RewriteCond: input='www.THEDOMAINNAME.com' pattern='(www\.)?(.+)' => matched
[rid#28379535/initial/2] (1) [perdir c:\program files (x86)\helicon\ape\] Rewrite URL to >> /searchwithbbb.org/ [INTERNAL_REDIRECT]
[rid#28379535/initial/4] (5) [perdir c:\program files (x86)\helicon\ape\] strip matching prefix: /searchwithbbb.org/ -> searchwithbbb.org/
[rid#28379535/initial/4] (3) [perdir c:\program files (x86)\helicon\ape\] applying pattern ([^.?]+[^.?/]) to uri searchwithbbb.org/
[rid#28379535/initial/4] (4) [perdir c:\program files (x86)\helicon\ape\] RewriteCond: input='www.THEDOMAINNAME.com' pattern='(.*)' => matched
[rid#28379535/initial/4] (2) [perdir c:\program files (x86)\helicon\ape\] escaping http://www.THEDOMAINNAME.comsearchwithbbb/
[rid#28379535/initial/4] (2) [perdir c:\program files (x86)\helicon\ape\] forcing responsecode 302 for http://www.THEDOMAINNAME.comsearchwithbbb/
[rid#28379535/initial/4] (3) [perdir c:\program files (x86)\helicon\ape\] applying pattern (.*) to uri /
[rid#28379535/initial/4] (4) [perdir c:\program files (x86)\helicon\ape\] RewriteCond: input='www.THEDOMAINNAME.com' pattern='(www\.)?(.+)' => matched
[rid#28379535/initial/4] (1) [perdir c:\program files (x86)\helicon\ape\] Rewrite URL to >> /searchwithbbb.org/ [INTERNAL_REDIRECT]
[rid#35236192/initial/1] (5) [perdir c:\program files (x86)\helicon\ape\] strip matching prefix: /searchwithbbb.org -> searchwithbbb.org
[rid#35236192/initial/1] (3) [perdir c:\program files (x86)\helicon\ape\] applying pattern ([^.?]+[^.?/]) to uri searchwithbbb.org
[rid#35236192/initial/1] (4) [perdir c:\program files (x86)\helicon\ape\] RewriteCond: input='www.THEDOMAINNAME.com' pattern='(.*)' => matched
[rid#35236192/initial/1] (2) [perdir c:\program files (x86)\helicon\ape\] escaping http://www.THEDOMAINNAME.comsearchwithbbb/
[rid#35236192/initial/1] (2) [perdir c:\program files (x86)\helicon\ape\] forcing responsecode 302 for http://www.THEDOMAINNAME.comsearchwithbbb/
[rid#35236192/initial/1] (3) [perdir c:\program files (x86)\helicon\ape\] applying pattern (.*) to uri /
[rid#35236192/initial/1] (4) [perdir c:\program files (x86)\helicon\ape\] RewriteCond: input='www.THEDOMAINNAME.com' pattern='(www\.)?(.+)' => matched
[rid#35236192/initial/1] (1) [perdir c:\program files (x86)\helicon\ape\] Rewrite URL to >> /searchwithbbb.org/ [INTERNAL_REDIRECT]
[rid#35236192/initial/3] (5) [perdir c:\program files (x86)\helicon\ape\] strip matching prefix: /searchwithbbb.org/ -> searchwithbbb.org/
[rid#35236192/initial/3] (3) [perdir c:\program files (x86)\helicon\ape\] applying pattern ([^.?]+[^.?/]) to uri searchwithbbb.org/
[rid#35236192/initial/3] (4) [perdir c:\program files (x86)\helicon\ape\] RewriteCond: input='www.THEDOMAINNAME.com' pattern='(.*)' => matched
[rid#35236192/initial/3] (2) [perdir c:\program files (x86)\helicon\ape\] escaping http://www.THEDOMAINNAME.comsearchwithbbb/
[rid#35236192/initial/3] (2) [perdir c:\program files (x86)\helicon\ape\] forcing responsecode 302 for http://www.THEDOMAINNAME.comsearchwithbbb/
[rid#35236192/initial/3] (3) [perdir c:\program files (x86)\helicon\ape\] applying pattern (.*) to uri /
[rid#35236192/initial/3] (4) [perdir c:\program files (x86)\helicon\ape\] RewriteCond: input='www.THEDOMAINNAME.com' pattern='(www\.)?(.+)' => matched
[rid#35236192/initial/3] (1) [perdir c:\program files (x86)\helicon\ape\] Rewrite URL to >> /searchwithbbb.org/ [INTERNAL_REDIRECT] \
[rid#21943666/initial/2] (5) [perdir c:\program files (x86)\helicon\ape\] strip matching prefix: /searchwithbbb.org/ -> searchwithbbb.org/
[rid#21943666/initial/2] (3) [perdir c:\program files (x86)\helicon\ape\] applying pattern ([^.?]+[^.?/]) to uri searchwithbbb.org/
[rid#21943666/initial/2] (4) [perdir c:\program files (x86)\helicon\ape\] RewriteCond: input='www.THEDOMAINNAME.com' pattern='(.*)' => matched
[rid#21943666/initial/2] (2) [perdir c:\program files (x86)\helicon\ape\] escaping http://www.THEDOMAINNAME.comsearchwithbbb/
[rid#21943666/initial/2] (2) [perdir c:\program files (x86)\helicon\ape\] forcing responsecode 302 for http://www.THEDOMAINNAME.comsearchwithbbb/
[rid#21943666/initial/2] (3) [perdir c:\program files (x86)\helicon\ape\] applying pattern (.*) to uri /
[rid#21943666/initial/2] (4) [perdir c:\program files (x86)\helicon\ape\] RewriteCond: input='www.THEDOMAINNAME.com' pattern='(www\.)?(.+)' => matched
[rid#21943666/initial/2] (1) [perdir c:\program files (x86)\helicon\ape\] Rewrite URL to >> /searchwithbbb.org/ [INTERNAL_REDIRECT]
Edited by AndrushkaUS - 12 December 2011 at 4:51am
|
| Back to Top |
|
| |
Guests Guest

Joined: 01 October 2003
Online Status: Online Posts: -149
|
| Posted: 12 December 2011 at 5:15am | IP Logged
|
|
|
Have you tried to comment your httpd.conf rules? Seems like its them that loop everything.
Regards
Andrew
|
| Back to Top |
|
| |
billo355 Newbie

Joined: 02 April 2009
Online Status: Offline Posts: 8
|
| Posted: 12 December 2011 at 7:27am | IP Logged
|
|
|
I'm not clear on what you're saying - the rules I showed
(which were taken directly from the Ape examples section)
are the only rules used.
|
| Back to Top |
|
| |
Guests Guest

Joined: 01 October 2003
Online Status: Online Posts: -149
|
| Posted: 12 December 2011 at 7:49am | IP Logged
|
|
|
Well,
I edited you log and it shows that first request matches you first httpd.conf rule and then goes to the second one... it continues endlessly.
Htppd.conf rules are used on top of your .htaccess rules.
Regards
Andrew
|
| Back to Top |
|
| |
billo355 Newbie

Joined: 02 April 2009
Online Status: Offline Posts: 8
|
| Posted: 12 December 2011 at 8:15am | IP Logged
|
|
|
I understand - but I have nothing in my httpd.conf file
other than the selection of which modules are loaded.
Could the rule be coming from somewhere else?
|
| Back to Top |
|
| |
Guests Guest

Joined: 01 October 2003
Online Status: Online Posts: -149
|
| Posted: 13 December 2011 at 6:02am | IP Logged
|
|
|
Try this one: add NS flag to each rule. This must fix the issue 100%.
|
| Back to Top |
|
| |
ALANNIS Newbie

Joined: 13 December 2011
Online Status: Offline Posts: 1
|
| Posted: 13 December 2011 at 10:50pm | IP Logged
|
|
|
I have the confusion in the comment the httpd.conf rules? Please any one explain in this thing
__________________ final year ieee projects
|
| Back to Top |
|
| |
Guests Guest

Joined: 01 October 2003
Online Status: Online Posts: -149
|
| Posted: 14 December 2011 at 4:43am | IP Logged
|
|
|
please, clarify.
|
| Back to Top |
|
| |