Welcome to WebmasterWorld Guest from 184.108.40.206
An Introduction to Redirecting URLs on an Apache Server [webmasterworld.com]
it is in the library, the link is right beside the moderator's name in each forum.
<added>gotcha jim ;)
[edited by: jatar_k at 1:33 am (utc) on Mar. 4, 2003]
No problem... Just remember, start small. For example, redirect a non-existent URL to your home page as an initial experiment:
RewriteRule ^no\_such\_file\.html$ /index.html [R=301,L]
trying out a custom error page for starters..
.htaccess file, created in editpad lite
(plain text editor very similar to windows notepad):
(tried using windows wordpad too):
ErrorDocument 404 /error.html[carriage return]
saved as type:
tried all the following:
text file (*.txt)
all files (*.*)
perl file (*.pl)
unicode text document (*.*)
checked I saved it as .htaccess , not .htaccess.txt or anything like that
uploaded to root of my apache/linux server using cute FTP in ASCII mode;
checked with server admin; they say yep .htaccess supported;
uploaded error.html to root, very basic html doc, checked it displays ok when called directly;
... try accessing site;I'm just getting a 500 internal server error every time.
Any ideas most appreciated, I bet it's something really simple I'm messing up on.. I remember going through something very similar first time I tried to use perl..
uploaded to root of my apache/linux server using cute FTP in ASCII mode
Sounds like you're doing all the right things. I'm sure you've probably checked this, just in case, check the permissions on the file.
Give it say 644. Not familiar with cute FTP but if it were to set permissions incorrectly, you could indeed get the dreaded 500 while doing everything else correctly.
Server admin suggested using the server path
rather than just plain old
but no, no joy.
I even tried an absolute path
again, the dreaded..
I have several accounts with this hosting provider, subscribed at different times; they all fail in the same way.
I can feel another email to the server admin coming on. They're a bit variable in their response speed, hopefully they've not been out on the beer this evening!
Nothing wrong with what you did. Check the following, then contact host and complain.
Verify that the file is named .htaccess on your server, and that it's priveleges are set to allow read access. chmod 444 (Owner:read, Group:Read, World:Read) should work.
Another thought... What does your raw error log say? This can often be very helpful.
It sounds like your host needs to add an AllowOverride [httpd.apache.org] All directive to your (virtual) server to enable your .htaccess to function. If they won't do this, or offer you a lower level of AllowOverride, you should begin looking for a new host.
Cheers Guys, Gals
Server admin suggested using the server path
That would not work for custom error documents. Either a local file, as you had it defined, a qualified URL or text can be used. Not the path to a file.
Do you know anyone who has a hosting account elsewhere where you could try the .htaccess file. If it works there then that will give you more to go on when you contact your host.
it's even highly recommended to use the complete path of the local file to let the errordocument setting work side wide in subdirectories, too.
[edited by: hakre at 4:16 am (utc) on Mar. 4, 2003]
Agreed, I meant "local file" as in relative to DocumentRoot. Given that we are talking about .htaccess/Apache, I was thinking in those terms.
The file path would not be the same as it's path relative to DocumentRoot. .htaccess would look for the file relative to DocumentRoot.
Just received an email from server admin.
"Sorry, we can't allow you to change the 404's; it's a security issue. Let us know which of your pages you want to use as the 404 & we'll set it up server-side for you"
Paraphrasing my response.
"Cheers. What the!&$%£ *can* I do with .htaccess then, without your holding my hand, what with you already having said the feature is supported?"
I've gently suggested they provide a FAQ..
Chuckle. These guys take the biscuit sometimes, but I must say in their defence their performance in terms of price and uptime tends to outweigh the downsides, so I guess I'll still stick with them. Bit annoying though to be told one thing, spend God knows how long in a futile attempt to get something working, and drag a load of others' time into it into the bargain, only to be told later "Actually...."
Allow use of the authorization directives (AuthDBMGroupFile, AuthDBMUserFile, AuthGroupFile, AuthName, AuthType, AuthUserFile, Require, etc.).
Allow use of the directives controlling document types (AddEncoding, AddLanguage, AddType, DefaultType, ErrorDocument, LanguagePriority, etc.).
Allow use of the directives controlling directory indexing (AddDescription, AddIcon, AddIconByEncoding, AddIconByType, DefaultIcon, DirectoryIndex, FancyIndexing, HeaderName, IndexIgnore, IndexOptions, ReadmeName, etc.).
Allow use of the directives controlling host access (Allow, Deny and Order).
Allow use of the directives controlling specific directory features (Options and XBitHack).
Basically, your host can pick-and-choose which Options you are allowed to change (Override), so the answer to your question is, "it depends".
However, I just flat won't deal with a host that won't give me AllowOverride All priveleges, or that does a bad job handling site security issues, or that allows servers to go down for more than a few (more than 3) minutes per year. There are simply too many decent hosting companies out there to mess with second-rate service. I pay a little more (nothing if compared to revenue) for decent service that makes my life easier, and don't sweat the fact that I'm paying a whole extra $5 or $10 a month.
I don't know if I answered the question you intended, but try each of the directive types that interest you, and see if they work.
If it does work, you need to put a .htaccess file in your subdirs to point to '../error404.html'.
HTTP 404 - File not found
so, I'm suspecting this is coming from within the browser, not their server.
If I type in an invalid filename for WW, though, using IE, I get the forum's custom 404 - the 'scream' painting - so I'm totally confused.
What, in their linux/apache (virtual?) setup, could cause this weirdness?
Is it maybe that if an actual 404 code is returned in the http headers to IE, it's tough luck, you get it's own error page, and not any other associated content the server sent? That's a bit off eh? Wonder if the mysterious 'virtual server configuration' would allow for not sending a 404 if that were the case..
I'm beginning to get rather shy of even trying to ban email harvesters / bad robots using .htaccess lol