[HTACCESS] Server Variable

Deskripsi
     variable yang sangat membantu dalam membuat htaccess di webserver (apache or other).


HowTo
Server variables are accessible through %{VAR_NAME}. Some of the most useful ones are below:

HTTP_USER_AGENTThis is the client being used to access your server. You can use this to identify the browser being used and show different content accordingly. It also allows you to block certain unfriendly bots from your server.
HTTP_REFERERThe referring page as sent by the browser. Note that this data is unreliable and can easily be modified by the user. You can use this variable to prevent hotlinking.
HTTP_HOSTThe current hostname. Possible values include domain.com, www.domain.com, sub.domain.com, an IP address or even your localhost.
SERVER_PORTThe current port. This value is 80 for http, 443 for https (ssl). Useful for redirecting users to force them onto the secure connection.
REMOTE_ADDRThe remote address of the user, also known as the IP. This allows you to block harmful bots or users.
SCRIPT_FILENAMEThe name of the requested file. This is the value that would be matched against the pattern of the RewriteRule.
QUERY_STRINGThis string contains all the GET data for the request. In other words, everything after the ? in the URL. For example, the QUERY_STRING variable for a request for file.php?foo=bar&pie=good will be \'foo=bar&pie=good\'
REQUEST_URIThe requested URI, a combination of the SCRIPT_FILENAME followed by the QUERY_STRING if there is one.

Post a Comment

Harap gunakan bahasa yang baik dan sopan, terima kasih