1 / 3
Caption Text
2 / 3
Caption Two
3 / 3
Caption Three margin testing

Friday, August 6, 2010

When site is “Under Construction”

http://www.askapache.com/htaccess/htaccess-for-webmasters.html

This lets google crawl, lets me access (1.1.1.1) without a password, and lets access from anyone WITH a password. It also allows for XHTML and CSS validation through w3.org

Article: Instruct Search Engines with a 503 Service Unavailabe header and Retry-After header while site is offline

AuthName "Under Development"
AuthUserFile /home/askapache.com/.htpasswd
AuthType basic
Require valid-user
Order Deny,Allow
Deny from all
Allow from 1.1.1.1 w3.org googlebot.com google.com google-analytics.com
Satisfy Any

Hide the Apache Version number and Server information

http://serversignature.com/Apache2-Turning-ServerSignature-off

By default many Apache installations tell the world what version of Apache you're running, what operating system/version you're running, and even what Apache Modules are installed on the server. Attackers can use this information to their advantage when performing an attack. It also sends the message that you have left most defaults alone.

The ServerSignature appears on the bottom of pages generated by apache such as 404 pages, directory listings, etc.

The ServerTokens directive is used to determine what Apache will put in the ServerHTTP response header. By setting it to Prod it sets the HTTP response header as follows:

 Server: Apache

To disable server signature, you will need to open your /etc/apache2/apache2.conf file,
and search for "ServerSignature" and press return. If you find it, edit it to:

ServerSignature Off
ServerTokens Prod


If you don't find it, just scroll to the end of the file and add these two lines.
Then, we need to reload apache configuration to put this new change in effect:

sudo /etc/init.d/apache2 reload

htaccess Tricks for Webmasters

http://www.askapache.com/htaccess/htaccess-for-webmasters.html

Apache For Webmasters is some of my favorite htaccess examples from some of my favorite .htaccess tutorials. These cut-and-paste ready htaccess code snippets are very useful for website and server administrators.

Apache Custom Error Messages

http://www.htmlcenter.com/blog/apache-custom-error-messages/

You log onto your shell and create a file called .htaccess in your document root. Let's assume that you want to display a custom error page for "File not found"-errors (code: 404).

Put the following code inside the .htaccess:


ErrorDocument 404 /path/to/error/document.html


Save it. Viola! It's all done.

You may also refer to a remote document:


ErrorDocument 404 http://errors.domain.com/404.php


The syntax is as follows:


ErrorDocument <3-digit-code> action


Can't get enough of them?

Successful Client Requests
200OK
201Created
202Accepted
203Non-Authorative Information
204 No Content
205Reset Content
206Partial Content
Client Request Redirected
300Multiple Choices
301Moved Permanently
302 Moved Temporarily
303See Other
304Not Modified
305 Use Proxy
Client Request Errors
400Bad Request
401 Authorization Required
402Payment Required (not used yet)
403Forbidden
404Not Found
405Method Not Allowed
406Not Acceptable (encoding)
407Proxy Authentication Required
408Request Timed Out
409 Conflicting Request
410Gone
411Content Length Required
412Precondition Failed
413Request Entity Too Long
414Request URI Too Long
415Unsupported Media Type
Server Errors
500 Internal Server Error
501Not Implemented
502Bad Gateway
503Service Unavailable
504Gateway Timeout
505HTTP Version Not Supported

Have fun!

Featured Post

Windows和Ubuntu双系统完全独立的安装方法

http://www.ubuntuhome.com/windows-and-ubuntu-install.html  | Ubuntu Home Posted by Snow on 2012/06/25 安装Windows和Ubuntu双系统时,很多人喜欢先安装windows,然...