You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Ari Pollak <aj...@aripollak.com> on 2004/09/16 02:44:02 UTC

[users@httpd] RewriteRules in httpd.conf don't work in 2.0.51

Hi there. I haven't tried this with any previous versions of Apache, so i don't
know if this is a bug introduced with .51. If I have the following in my
httpd.conf:

    RewriteEngine On
    RewriteLog conf/rewrite_log
    RewriteLogLevel 9
    RewriteRule .* http://www.foo.com [R]

Then nothing happens. Nothing gets written to rewrite_log, and no redirect
takes place. This occurs with any RewriteRule I try. If I put the same
directives into a .htaccess file somewhere, the rule works exactly as
expected for the directory the .htaccess file is in.
Am I doing something wrong? Is this a bug?


---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Re: RewriteRules in httpd.conf don't work in 2.0.51

Posted by Ari Pollak <aj...@aripollak.com>.
Joshua Slive <jslive <at> gmail.com> writes:
> They must either be inside the appropriate virtual host or you must
> set the appropriate RewriteOptions (and RewriteEngine) directive
> inside the virtualhost.  Try it again with the correct placement.

Ah, I didn't realize virtual hosts didn't inherit global rewrite rules by
default, since it seems every other global directive is inherited. Adding:
RewriteEngine on
RewriteOptions inherit

inside the appropriate virtualhost section fixed the problem. I'm not sure why
the rule still didn't work when I took out all the virtualhosts, but I'll just
guess that was a weird typo or something. I'm also not sure why the rule didn't
work when put inside the virtualhost in the first place, but it works now. Weird.

Thanks.


---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: RewriteRules in httpd.conf don't work in 2.0.51

Posted by Joshua Slive <js...@gmail.com>.
On Thu, 16 Sep 2004 12:27:08 +0000 (UTC), Ari Pollak <aj...@aripollak.com> wrote:
> Joshua Slive <jslive <at> gmail.com> writes:
> > You are probably putting it in the wrong place in the config file.
> > Exactly where is it going?  Are you using virtual hosts?
> 
> Yes, I do have virtual hosts. I've tried putting the Rewrite directives any
> place I could think of in the config - the beginning, the middle (both globally,
> before any virtualhosts), inside the appropriate virtualhost, the end (outside
> the virtualhost sections), all to no avail. I've even tried getting rid of all
> of the virtualhosts completely, but rewriting still doesn't work.

They must either be inside the appropriate virtual host or you must
set the appropriate RewriteOptions (and RewriteEngine) directive
inside the virtualhost.  Try it again with the correct placement.

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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Re: RewriteRules in httpd.conf don't work in 2.0.51

Posted by Ari Pollak <aj...@aripollak.com>.
Joshua Slive <jslive <at> gmail.com> writes:
> You are probably putting it in the wrong place in the config file. 
> Exactly where is it going?  Are you using virtual hosts?

Yes, I do have virtual hosts. I've tried putting the Rewrite directives any
place I could think of in the config - the beginning, the middle (both globally,
before any virtualhosts), inside the appropriate virtualhost, the end (outside
the virtualhost sections), all to no avail. I've even tried getting rid of all
of the virtualhosts completely, but rewriting still doesn't work.


---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] RewriteRules in httpd.conf don't work in 2.0.51

Posted by Joshua Slive <js...@gmail.com>.
On Thu, 16 Sep 2004 00:44:02 +0000 (UTC), Ari Pollak <aj...@aripollak.com> wrote:
> Hi there. I haven't tried this with any previous versions of Apache, so i don't
> know if this is a bug introduced with .51. If I have the following in my
> httpd.conf:
> 
>     RewriteEngine On
>     RewriteLog conf/rewrite_log
>     RewriteLogLevel 9
>     RewriteRule .* http://www.foo.com [R]
> 
> Then nothing happens. Nothing gets written to rewrite_log, and no redirect
> takes place. This occurs with any RewriteRule I try. If I put the same
> directives into a .htaccess file somewhere, the rule works exactly as
> expected for the directory the .htaccess file is in.
> Am I doing something wrong? Is this a bug?

You are probably putting it in the wrong place in the config file. 
Exactly where is it going?  Are you using virtual hosts?

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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Re: RewriteRules in httpd.conf don't work in 2.0.51

Posted by Ari Pollak <aj...@aripollak.com>.
>      RewriteRule ^.*$ http://www.foo.com [R]

Yep.. Tried it, no dice.





---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] RewriteRules in httpd.conf don't work in 2.0.51

Posted by Brian V Hughes <br...@Dartmouth.EDU>.
On Sep 15, 2004, at 08:44 PM, Ari Pollak wrote:
> Hi there. I haven't tried this with any previous versions of Apache, 
> so i don't
> know if this is a bug introduced with .51. If I have the following in 
> my
> httpd.conf:
>
>     RewriteEngine On
>     RewriteLog conf/rewrite_log
>     RewriteLogLevel 9
>     RewriteRule .* http://www.foo.com [R]

Have you tried this format for the match expression?

     RewriteRule ^.*$ http://www.foo.com [R]

I have many instances where an un-bounded expression in a RewriteRule 
doesn't match on anything in the URL. Once I add in the boundary 
characters, they work as expected.

-Brian


---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org