Re: [users@httpd] rewriterule causing [redirect/302] error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/4/05, Josh Greenwood <joshgreenwood@xxxxxxxxx> wrote:
> Hello,
>  I am using Apache 2.0.54. I am having difficulty with the following
> rewritecond/rewriterule:
>
>      # See if the requested page is http://www.test.com
>      RewriteCond  %{SERVER_NAME}  www.test.com
>      # It is. Now see if "www.test.com" is a folder in the webcontent/
> directory
>      RewriteCond
> %{DOCUMENT_ROOT}/webcontent/%{SERVER_NAME} -d
>      # it is.
>      RewriteRule  ^/(.*)$
> http://%{SERVER_NAME}%{REQUEST_URI} [S=5]
>
>  This produces the following output in rewritelog:
>
>  (2) init rewrite engine with requested uri /
>  (3) applying pattern '^/(.*)$' to uri '/'
>  (4) RewriteCond: input='www.test.com' pattern='www.test.com' => matched
>  (4) RewriteCond:
> input='C:/egranary/webcontent/www.test.com' pattern='-d' =>
> matched
>  (2) rewrite / -> http://www.test.com/
>  (2) implicitly forcing redirect (rc=302) with http://www.test.com/
>  (1) escaping http://www.test.com/ for redirect
>  (1) redirect to http://www.test.com/ [REDIRECT/302]
>
>  The above 8-line log sequence repeats itself a few thousand times per
> request.
>  My intention is to filter the request 'www.test.com', check to see if there
> exists a directory called 'www.test.com'
>  in a local directory called 'webcontent', and if there is, ignore the page
> in that local directory and retrieve the actual page from test.com. I
> realize this seems like a strange thing to do - it is for a configuration
> which normally serves pages out of the local webcontent folder,
>  due to little and/or unreliable Internet connectivity. In this example,
> 'www.test.com' would be an important enough
>  page to get the most current version. Note that the '[S=5]' in the
> rewriteRule is just skipping the rest of the
>  rules and conditions. The two rewriteconds seem to be doing their intended
> jobs, the rewriterule is not retrieving the page 'www.test.com' from the
> Internet. I appreciate any ideas.

I find your problem description very confusing.  It is obvious you are
creating a redirect loop, because you are redirecting back to the same
server with exactly the same path.  Exactly what is supposed to be
changed by this RewriteRule to prevent the same rules from matching
again?

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux