Home > Apache > Apache – tips/tricks

Apache – tips/tricks

# RewriteEngine

Enable or disalbes runtime rewriting engine

RewriteEngine on|off

# RewriteLog

# the following are not for .htaccess file, you can only put them to httpd.conf file. it will make the logs for mod_rewrite,

RewriteLog “/htdocs/shamun_rewrite.log”
RewriteLogLevel 9    # this value is lowest to highest

# RewriteCond

A good tool of apache, extremely good.

RewriteCond teststring conditionPattern

HTTP headers: connection & request:
HTTP_USER_AGENT
HTTP_REFERER
HTTP_COOKIE
HTTP_FORWARDED
HTTP_HOST
HTTP_PROXY_CONNECTION
HTTP_ACCEPT
REMOTE_ADDR
REMOTE_HOST
REMOTE_PORT
REMOTE_USER
REMOTE_IDENT
REQUEST_METHOD
SCRIPT_FILENAME
PATH_INFO
QUERY_STRING
AUTH_TYPE
server internals: date and time: specials:
DOCUMENT_ROOT
SERVER_ADMIN
SERVER_NAME
SERVER_ADDR
SERVER_PORT
SERVER_PROTOCOL
SERVER_SOFTWARE
TIME_YEAR
TIME_MON
TIME_DAY
TIME_HOUR
TIME_MIN
TIME_SEC
TIME_WDAY
TIME
API_VERSION
THE_REQUEST
REQUEST_URI
REQUEST_FILENAME
IS_SUBREQ
HTTPS

#() captures expressions which you can use with $1, $2, etc
RewriteCond %{HTTP_HOST} ^shamun.* [OR]
RewriteCond %{HTTP_HOST} ^www.shamun.*

# RewriteRule

# R = redirect, with code between 300 till 309
# L = stop, but if its internal trigger, then it may start the loop again

RewriteRule ^$  /folder/file [R=301, L]

# RewriteMap

This is interesting too, but we have to do it later.

Advertisements
Categories: Apache
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: