Hi, Ditzy,
That .htaccess works because of the line:
Code:
ErrorDocument 404 /404page.shtml
The "rewrite" bits never get used because your condition never happens.
Code:
RewriteCond %{HTTP_HOST} ^\confused\.co.uk
says: "If the server name starts with 'confused.co<any character>uk' then use the following rewrite rule"
As the server name is 'www.confused.co.uk', it never happens. "^" = "Starts with", your server name starts with "www". I guess the original rewrite was to change htt p://example.com to htt p://www.example.com
The "\" character in the condition is an escape character, to let you use "special" characters. The "." in rewrite conditions means "any character" so to actually specify "a dot" you use \ before it.
For your condition to work it would need to look like:
RewriteCond %{HTTP_HOST} ^www\.confused\.co\.uk
DON'T DO THIS !!
Your rewrite rule reads: "Take the bit after ww w.confused.co.uk and put it after 'htt p://www.confused.co.uk/'"
So basically, all you are doing is rewriting the same url. Waste of time.
The
Code:
ErrorDocument 404 /404page.shtml
is doing everything you need, so probably best to get rid of the rewrite stuff. I would comment it out - put a # at the start of each line:
#Options +FollowSymLinks
#RewriteEngine on
#RewriteCond %{HTTP_HOST} ^\confused\.co.uk
#RewriteRule ^(.*)$ http://www.confused.co.uk/$1 [R=permanent,L]
#SetEnvIf User-Agent indy.Library$ keep_out #block indy_Library spambot variants
If you really want to check for 404 Missing page errors yourself, rather than continue letting the server do it, let me know & I'll dig up some code.
The last line "SetEnv...." is doing nothing, unless there are more conditions that you haven't posted. It checks the "user agent" & if it ends with ($='Ends with' in rewrite world) "indy.Library" it sets a variable, which is only any use if you use the variable somewhere else.
Hope that helps.