Mailing List Archive

RewriteMap not allowed here
Hello People,

Im trying to learn the URL Rewriting Module on Apache
and have come accross a small problem,

I've placed this in to my httpd.conf file as suggested by the URL Rewriting
Guide,
and it looks a little like this:
-------------------------------------------------------------Snip Snip
<VirtualHost 192.168.30.152:80>
RewriteEngine on
SSLDisable
Port 80
ServerName www.somewhere.com
DocumentRoot /www/users/s/somewhere/www

<Directory /www/users/s/somewhere/www/beer>
RewriteMap deflector txt:/www/users/s/somewhere/deflector.map

RewriteCond %{HTTP_REFERER} !=""
RewriteCond ${deflector:%{HTTP_REFERER}} ^-$
RewriteRule ^.* %{HTTP_REFERER} [R,L]

RewriteCond %{HTTP_REFERER} !=""
RewriteCond ${deflector:%{HTTP_REFERER}|NOT-FOUND} !=NOT-FOUND
RewriteRule ^.* ${deflector:%{HTTP_REFERER}} [R,L]
</Directory>

</VirtualHost>
-------------------------------------------------------------Cut Cut



and Have this in my deflector.map
------------------------------------------------------------- Snip Snip
##
## deflector.map
##

http://www.somewhere.com/redirect.html -
http://shop.somewhere.com/redirect.html http://www.somewhere.com
------------------------------------------------------------- Cut Cut



but I still get the same error when I run configtest
------------------------------------------------------------- Snip Snip
[root@some bin]# ./httpsdctl configtest
Syntax error on line 1068 of /www/httpd/conf/httpd.conf:
RewriteMap not allowed here
------------------------------------------------------------- Cut Cut



Im Running RH Linux 7
Server version: Apache/1.3.20 (Unix)

Some kind or direction would be greatly appreciated
Do I need to install any modules or the like or do I need to place the
RewriteEngine
on somewhere else,


---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org
RE: RewriteMap not allowed here [ In reply to ]
> From: Korey G. [mailto:korey@awpg.com]

>
> Im trying to learn the URL Rewriting Module on Apache
> and have come accross a small problem,

Put the RewriteMap in the main server context, outside any <Directory>
section.

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
For additional commands, e-mail: users-help@httpd.apache.org
RE: RewriteMap not allowed here [ In reply to ]
> From: Korey G. [mailto:korey@awpg.com]

> Thanks Thoug
> But I've tried what you suggest and the server just ignores the
> whole thing
> and does nothing

Use the RewriteLog to figure out what is going on. Your rules make very
little sense to me, and I have no idea what you are trying to do, so I can't
help.

Jsohua.


---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org
RE: RewriteMap not allowed here [ In reply to ]
> From: Korey G. [mailto:korey@awpg.com]

>
> What Im trying to do is to have everyone
> from ServerA.com go to index.html and everyone
> from ServerB.com to go to index2.html

By "from ServerA.com" I assume you mean they clicked on a link on a page at
ServerA.com. If my assumption is correct, then you want something like:

RewriteCond %{HTTP_REFERER} ^servera.com$ [NC]
RewriteRule (.*) /index.html
RewriteCond %{HTTP_REFERER} ^serverb.com$ [NC]
RewriteRule (.*) /index2.html

Of course, you weren't very specific in your requirements, so this is just a
guess.

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
For additional commands, e-mail: users-help@httpd.apache.org
RE: RewriteMap not allowed here [ In reply to ]
> From: Korey G. [mailto:korey@awpg.com]

> Its not working, these are my entries
>
> 192.168.2.143- - [04/Feb/2002:17:29:27 -0500]
> [www.servera.com/sid#81e5514][rid#826ebb4/initial/redir#1] (2)
> init rewrite
> engine with requested uri /beer/index.html
> 192.168.2.143 - - [04/Feb/2002:17:29:27 -0500]
> [www.servera.com/sid#81e5514][rid#826ebb4/initial/redir#1] (1)
> pass through
> /beer/index.html
>
> >RewriteCond %{HTTP_REFERER} ^servera.com$ [NC]
> >RewriteRule (.*) /index.html
> >RewriteCond %{HTTP_REFERER} ^serverb.com$ [NC]
> >RewriteRule (.*) /index2.html

The easiest way to handle this stuff is to avoid the per-directory config
confusion by placing the Rewrite stuff in the main server context, outside
any <Directory> section. Then, if necessary, you can make the RewriteRule
more specific, for example:

RewriteRule ^/beer/.* /index.html

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
For additional commands, e-mail: users-help@httpd.apache.org
RE: RewriteMap not allowed here [ In reply to ]
Thanks Thoug
But I've tried what you suggest and the server just ignores the whole thing
and does nothing

At 16:08 2/4/02 -0500, you wrote:

> > From: Korey G. [mailto:korey@awpg.com]
>
> >
> > Im trying to learn the URL Rewriting Module on Apache
> > and have come accross a small problem,
>
>Put the RewriteMap in the main server context, outside any <Directory>
>section.
>
>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
>For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org
RE: RewriteMap not allowed here [ In reply to ]
Thanks,
RewriteLog should make more sense out of it,
I don't why I didnt think of that,

-Korey


At 16:43 2/4/02 -0500, you wrote:

> > From: Korey G. [mailto:korey@awpg.com]
>
> > Thanks Thoug
> > But I've tried what you suggest and the server just ignores the
> > whole thing
> > and does nothing
>
>Use the RewriteLog to figure out what is going on. Your rules make very
>little sense to me, and I have no idea what you are trying to do, so I can't
>help.
>
>Jsohua.
>
>
>---------------------------------------------------------------------
>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
>For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org
RE: RewriteMap not allowed here [ In reply to ]
What Im trying to do is to have everyone
from ServerA.com go to index.html and everyone
from ServerB.com to go to index2.html

Is this possible?

At 16:43 2/4/02 -0500, you wrote:

> > From: Korey G. [mailto:korey@awpg.com]
>
> > Thanks Thoug
> > But I've tried what you suggest and the server just ignores the
> > whole thing
> > and does nothing
>
>Use the RewriteLog to figure out what is going on. Your rules make very
>little sense to me, and I have no idea what you are trying to do, so I can't
>help.
>
>Jsohua.
>
>
>---------------------------------------------------------------------
>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
>For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org
RE: RewriteMap not allowed here [ In reply to ]
Its not working, these are my entries

192.168.2.143- - [04/Feb/2002:17:29:27 -0500]
[www.servera.com/sid#81e5514][rid#826ebb4/initial/redir#1] (2) init rewrite
engine with requested uri /beer/index.html
192.168.2.143 - - [04/Feb/2002:17:29:27 -0500]
[www.servera.com/sid#81e5514][rid#826ebb4/initial/redir#1] (1) pass through
/beer/index.html


At 17:18 2/4/02 -0500, you wrote:

> > From: Korey G. [mailto:korey@awpg.com]
>
> >
> > What Im trying to do is to have everyone
> > from ServerA.com go to index.html and everyone
> > from ServerB.com to go to index2.html
>
>By "from ServerA.com" I assume you mean they clicked on a link on a page at
>ServerA.com. If my assumption is correct, then you want something like:
>
>RewriteCond %{HTTP_REFERER} ^servera.com$ [NC]
>RewriteRule (.*) /index.html
>RewriteCond %{HTTP_REFERER} ^serverb.com$ [NC]
>RewriteRule (.*) /index2.html
>
>Of course, you weren't very specific in your requirements, so this is just a
>guess.
>
>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
>For additional commands, e-mail: users-help@httpd.apache.org


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