Forum Moderators: phranque

Message Too Old, No Replies

mod_rewrite directives- in which context?

works in <virtualhost>, not in serverconfig

         

flex55

2:20 pm on Nov 13, 2003 (gmt 0)

10+ Year Member



hi guys,

i have the following simple rewrite directives:

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} ^aaa
RewriteRule ^.* /other.txt [PT,L]

now, it works well on the <virtualhost> directive-
but as I want to apply it to all virtualhosts, i want to put it in server config- yet it doesn't work, for some reason, in the server config.

does anyone have an idea?

thanks!
f.

jdMorgan

3:06 pm on Nov 13, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Two possible problems:

First, the local path "/other" is not yet defined in a config context - you could try a canonical URL -- "http://<something>" with an external redirect instead.

And -- possibly related -- why are you using the [PT] flag with a local pathname?

Jim

flex55

4:05 pm on Nov 13, 2003 (gmt 0)

10+ Year Member



Ah. My bad. The PassThrough was mistakenly placed there- I just copied it from another rewrite I had-

Jim, following your suggestion- I tried:

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} ^aaa
RewriteRule ^.* "http://www.domain.com/other.txt" [L]

still- it works perfectly on the virtualhost section, doesn't work at all on the serverconfig.
also, i tried to have a RewriteLogLevel 9, hoping to see something at the rewrite log file, but it was empty.

any more ideas?

thanks again for the reply,
f.

jdMorgan

4:20 pm on Nov 13, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Have you specified RewriteOptions inherit for each virtual server? That may be required.

Jim

flex55

4:39 pm on Nov 13, 2003 (gmt 0)

10+ Year Member



just tried "RewriteOptions inherit" in the virtualhost-

no luck :-(
still doesn't work...

jdMorgan

6:36 pm on Nov 13, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



flex55,

Well, I'm fresh out of ideas... Perhaps a read through some other threads on this subject [google.com] will help.

Jim