Re: htaccess file
- From: David Bolt <blacklist-me@xxxxxxxxxx>
- Date: Sun, 30 Dec 2007 18:38:59 +0000
On Sun, 30 Dec 2007, Barely Audible wrote:-
RewriteEngine On^ ^
RewriteCond %{HTTP_USER_AGENT} ^.*Ants.*$ [OR]
Any real reason for those anchors since you're matching the entire
string?
RewriteCond %{HTTP_USER_AGENT} ^.*attach.*$ [OR]^^
Try using NC,OR.
RewriteCond %{HTTP_USER_AGENT} ^.*BackWeb.*$ [OR]
RewriteCond %{HTTP_USER_AGENT} ^.*Bandit.*$ [OR]
RewriteCond %{HTTP_USER_AGENT} ^.*Zeus.*$
And don't forget the [NC] at the end of this line.
RewriteRule ^.*$ http://www.use_a_normal_browser_to_view_the_jed_site_p^^^^
Using ".*" does the same job
ages_please.com/ [L]
Try replacing the [L] with [NC,R=301,L]
The trouble is I seem to have done something wrong and I keep getting
the following error when accessing the web site....
Error 500
Any clues as to what I am doing wrong will be greatly appreciated...
There's something in your .htaccess file that the web server doesn't
understand. Posting the full file, rather than snippets, would be a good
start.
Anyway, this one works for me:
davjam@cobra-mk3:~> cat ~/public_html/new_dir/.htaccess
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} .*lynx.* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} .*linx.* [NC]
RewriteRule .* http://www.google.com/ [NC,R=301,L]
This will redirect browsers those that identify themselves as Lynx or
Linx (a play on links), to Google while leaving others to go through to
the (blank) page. Here's the results of a quick telnet testing:
davjam@cobra-mk3:~> telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /~davjam/new_dir/ HTTP/1.0
User-Agent: Links
HTTP/1.1 200 OK
Date: Sun, 30 Dec 2007 18:22:02 GMT
Server: Apache/2.2.4 (Linux/SUSE)
X-Powered-By: PHP/5.2.5
Content-Length: 0
Connection: close
Content-Type: text/html
Connection closed by foreign host.
davjam@cobra-mk3:~> telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /~davjam/new_dir/ HTTP/1.0
User-Agent: Lynx
HTTP/1.1 301 Moved Permanently
Date: Sun, 30 Dec 2007 18:22:19 GMT
Server: Apache/2.2.4 (Linux/SUSE)
Location: http://www.google.com/
Content-Length: 309
Connection: close
Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="http://www.google.com/">here</a>.</p>
<hr>
<address>Apache/2.2.4 (Linux/SUSE) Server at davjam.org Port 80</address>
</body></html>
Connection closed by foreign host.
Alternatively, replace the 301 with a 302 for a temporary "moved"
response.
Regards,
David Bolt
--
www.davjam.org/lifetype/ www.distributed.net: OGR@100Mnodes, RC5-72@15Mkeys
SUSE 10.1 32bit | openSUSE 10.2 32bit | openSUSE 10.3 32bit | openSUSE 11.0a0
SUSE 10.1 64bit | openSUSE 10.2 64bit |
RISC OS 3.6 | TOS 4.02 | openSUSE 10.3 PPC |RISC OS 3.11
.
- Prev by Date: Re: dependency hell
- Next by Date: Re: Three monitors
- Previous by thread: hdparm spindown not working because app is constantly accessing?
- Next by thread: Re: htaccess file
- Index(es):
Relevant Pages
|