You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Selmer Ausland <se...@shawcable.com> on 2003/12/16 22:10:01 UTC
[users@httpd] Mod rewrite problems
Hello Group;
I am running Apache 2.0.48, with Windows NT 4.0 on a webhosting
server.
I want to prevent hot-linking to my graphics etc. and ban, or redirect,
spam-bots from my server.
I inserted the following code (below)to prevent hotlinking, to my images
etc., and to ban spambots, first, into the main body of my http conf and
when that did not work, I tried it in my root VirtualHost. It works fine
there.
The problem now is, it now cuts of access to the images and also
prevents viewing the webpages.
When I access my webpages, the webpage shows up but not the graphics.
When I add the code to ban the spambots then I cannot view the webpages,
and receive a forbidden message.
The rewrite section also gives me the following error quote:
"Redirection limit for this url exceeded. Unable to load the requested
page!"
This is the code I am using:
(All name-based VirtualHosts)
<VirtualHost *>
ServerAdmin webmaster@mydomain.com
DocumentRoot "D:/Apache2/htdocs"
ServerName www.mydomain.com
ServerAlias mydomain.com
<Directory "D:/Apache2/htdocs">
Options Indexes
AllowOverride AuthConfig Options FileInfo
Order Allow,Deny
Allow from all
</Directory>
RewriteEngine on
RewriteLog logs/modrewrite.log
RewriteLogLevel 1
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://mydomain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.mydomain.com/.*$ [NC]
RewriteRule.*\.(gif|GIF|jpg|mid|wav|mp3|avi|mpeg|)$ - [F]
RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR,NC]
RewriteCond %{HTTP_USER_AGENT} ^Bot\mailto:craftbot@yahoo.com [OR,NC]
RewriteRule .*\. http://www.mydomain.com/errors/404.html [R]
</VirtualHost>
Could some kind soul please advise me as to how I can enable the above,
and still be able to view my graphics and webpages. I have studied the
Documentation on Apache and Googled until I am ga-ga and still can't
seem to find the right combination.
Most of the documentation seems pointed towards .htaccess files. I would
prefer to have to it in my main http conf if possible.
Any help would be appreciated.
Thanks. Selmer Ausland
---------------------------------------------------------------------
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] Mod rewrite problems
Posted by Robert Andersson <ro...@profundis.nu>.
Selmer Ausland wrote:
> The rewrite section also gives me the following error quote:
>
> "Redirection limit for this url exceeded. Unable to load the requested
> page!"
> [...snip...]
> Could some kind soul please advise me as to how I can enable the above,
> and still be able to view my graphics and webpages. I have studied the
> Documentation on Apache and Googled until I am ga-ga and still can't
> seem to find the right combination.
Study the rewrite log after making a "legal" request, and then do the same
for an "illegal" request. That should tell you where it goes wrong.
Regards,
Robert Andersson
---------------------------------------------------------------------
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