You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Randy Terbush <ra...@zyzzyva.com> on 1997/07/06 17:37:08 UTC
Re: [BUG] mod_rewrite and redirect code
+1
> The following rule:
>
> RewriteRule ^/~marcs/(.*) http://valis/~marcs/$1 [redirect=permanent]
>
> still returns a 302 instead of a 301 like it should. PR#777 is also about
> this.
>
> The following patch fixes it, but I haven't really had the time to look
> and see if it is correct. Ralf?
>
> Index: mod_rewrite.c
> ===================================================================
> RCS file: /export/home/cvs/apache/src/mod_rewrite.c,v
> retrieving revision 1.31
> diff -c -r1.31 mod_rewrite.c
> *** mod_rewrite.c 1997/06/22 03:45:00 1.31
> --- mod_rewrite.c 1997/07/05 19:53:34
> ***************
> *** 1624,1629 ****
> --- 1624,1630 ----
> and the current URL still is not a fully qualified one we
> finally prefix it with http[s]://<ourname> explicitly */
> if (flags & RULEFLAG_FORCEREDIRECT) {
> + r->status = p->forced_responsecode;
> if ( !(strlen(r->filename) > 7 &&
> strncmp(r->filename, "http://", 7) == 0)
> && !(strlen(r->filename) > 8 &&
> ***************
> *** 1659,1665 ****
> else
> rewritelog(r, 2, "[per-dir %s] prepare forced redirect %s -> %s", perdir, r->filename, newuri);
> r->filename = pstrdup(r->pool, newuri);
> - r->status = p->forced_responsecode;
> return 1;
> }
> }
> --- 1660,1665 ----