Forum Moderators: phranque

Message Too Old, No Replies

httpd.conf rewriterule difference?

help convert this small rewriterule set

         

Taurus_II

9:34 am on Feb 12, 2004 (gmt 0)

10+ Year Member



Whilst trying to decide whether to put my Rewrite rules in .htaccess or httpd.conf could some answer two questions.

1. Where in http.conf should I put the following, should it be within my <Directory /> section because when I try, the site gets forbidden, no matter if the rules are met or not?

2. I note from previous postings there is subtle syntax difference to rules when in httpd.conf. Yes, I have read the rewrite_mod docs but cannot get my head around it all yet. Take several read for me ha ha! If someone would just show by example with the text below, that'll get me going.

< cut down example >

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]
RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]
RewriteCond %{HTTP_REFERER} q=guestbook [NC,OR]
RewriteCond %{HTTP_REFERER} q=g%E4stebuch [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?flipdog\.com [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://www.iaea.org
RewriteRule!^403.htm$ - [F,L]

Cheers,

operafan

9:40 am on Feb 12, 2004 (gmt 0)

10+ Year Member



I just dabble with it 1/2 hr ago & posted my toying.
I presume this is for the main domain? You have no other virtual domains under it?
I placed the rewrite at the bottom <virtualhost *> section.
Inside there you'll have to put
<VirtualHost *>
ServerName abc.com
ServerAlias www.abc.com
DocumentRoot /www/htdocs
RewriteEngine On
RewriteCond ...
RewriteRule!^/403.htm$ - [F,L] - You will have to add " / " for it to work it httpd.conf while in htaccess none is needed.
</virtualhost>

Taurus_II

11:44 am on Feb 12, 2004 (gmt 0)

10+ Year Member



operafan,

That appears to work. Thanks!

operafan

1:42 am on Feb 13, 2004 (gmt 0)

10+ Year Member



I tested it another time on a host with only the main domain with that method I suggested but did not work, very strange.
But tried this method & it worked : www.webmasterworld.com/forum92/781.htm