chilipie 0 Report post Posted October 27, 2004 So, who wants a site where instead of getting a default "Error 404" page in that ghastly font (Times) when you type the wrong address, you get a beautiful "Error 404" page that fits with your site's layout, colour and font scheme? Well, if you do, I'm going to show you how to do it with .htaccess. --- The most commonly occuring error pages are: 400 Bad Request401 Authorization Required403 Forbidden404 Page Not Found500 Internal Server Error503 Service UnavailableOpen up a new file in your favourite text editor. Enter this: ErrorDocument 400 /400.htmErrorDocument 401 /401.htmErrorDocument 403 /403.htmErrorDocument 404 /404.htmErrorDocument 500 /500.htmErrorDocument 501 /501.htmChange "/400.htm" etc. to the server path (not URL) of the error document. Now, save this file as "htaccess.txt" and upload/FTP it to your webspace (if you want it to affect all of your directories, make sure it is in "public_html" or "www". Then rename it to ".htaccess" (remember the dot). There you go! Type in an incorrect address at your domain, and it should come up with your custom error document. Share this post Link to post Share on other sites
lhunath 0 Report post Posted October 27, 2004 Very helpful, thanks a dozen for sharing this Share this post Link to post Share on other sites
overture 0 Report post Posted October 28, 2004 Would this be better than using the Custom Error Pages option in CPanel? is there any other benefits for either? Share this post Link to post Share on other sites
chilipie 0 Report post Posted October 28, 2004 Would this be better than using the Custom Error Pages option in CPanel? is there any other benefits for either? <{POST_SNAPBACK}> I don't know if there are any real benefits to it, but it is normally better to learn something this way rather than just using a system in cPanel. Also, if you ever have hosting where the only way of managing your files is through FTP, you can just use this method. Share this post Link to post Share on other sites
jcguy 0 Report post Posted October 30, 2004 A question here, is the .htaccess file supported by all servers? Do all servers recognise it? From your post, I presume that you still have to edit the style of the custom error document? Or do you just need to upload the .htaccess file only?Sorry, Im new to this htacess thing. Looks very useful to me. Share this post Link to post Share on other sites
r3d1405241470 0 Report post Posted October 30, 2004 actually most free unix hosting support htaccess and some free hosting disable it for security reasons.about the error pages, you have to create a new one, your own customize error pages. if error occured it is redirected by the htaccess to the pages you've create not to the old boring error pages Share this post Link to post Share on other sites
deivid1405241470 0 Report post Posted October 30, 2004 .htaccess can be used to stop hotlinking too. Hotlinking, also known as deep linking, occurs when one web site links directly to graphics files on another web site. RewriteEngine onRewriteCond %{HTTP_REFERER} !^http://(www\.)?yoursite.com(/)?.*$ [NC]RewriteRule .*\.(gif|jpg|jpeg|bmp|zip)$ http://http://ww38.yoursite.com/leech.htm [R,NC] The 2nd line checks the referer, the allowed pages to do hotlinking. You can duplicate the line and add another site.The 3rd line are the protected extensions, and the page to redirect... like DIE LEECHERS!!!! or something more extreme .Greets Deivid Share this post Link to post Share on other sites
r3d1405241470 0 Report post Posted October 30, 2004 there are lot more things you can do with .httacess from redirection to protection. kindly search google for more Share this post Link to post Share on other sites
chilipie 0 Report post Posted October 30, 2004 A question here, is the .htaccess file supported by all servers? <{POST_SNAPBACK}> I think it is only supported by Apache, but I'm not sure - I'll look into it. Share this post Link to post Share on other sites
Hercco 0 Report post Posted November 5, 2004 I think it is only supported by Apache, but I'm not sure - I'll look into it. <{POST_SNAPBACK}> .htaccess is a Apache thing only. At least it is originally used in Apache, tt might be that some other servers have copied it. Share this post Link to post Share on other sites
avalon1405241471 0 Report post Posted November 6, 2004 Would this be better than using the Custom Error Pages option in CPanel? is there any other benefits for either? <{POST_SNAPBACK}> It the same, it will tell the system to point to where when the error occurs.Both are as good. Share this post Link to post Share on other sites
chiiyo 0 Report post Posted April 28, 2005 Can someone tell me whether anything is REQUIRED in the .htaccess file for Xisto? I think I accidentally deleted it and just wondering whether there is something essential inside the .htaccess file...Because all my php files are turning up blank... O_O Share this post Link to post Share on other sites