Introduction to Apache Rewrite

Source: Internet
Author: User
Tags http authentication
1. Turn on rewrite

sudo a2enmod rewrite

2. Deactivate rewrite

sudo a2dismod rewrite

3. Server environment variables

The environment variables that Apache provides to the Rewirte module are roughly divided into 5 types.
Part I : HTTP headers Partial parameters
Parameter name:http_user_agent
Sample reference value: mozilla/5.0 (Windows; U Windows NT 5.1; ZH-CN; rv:1.9.0.8) gecko/2009032609 firefox/3.0.8
Description: Equivalent to server parameters in PHP: $_server["Http_user_agent"]
Parameter name:Http_referer
Sample reference value: http://www.test.cn/test.php
Description: Equivalent to server parameters in PHP: _server["Http_referer"]
Parameter name:Http_cookie
Sample reference value: ZDEDEBUGGERPRESENT=PHP,PHTML,PHP3
Description: Equivalent to server parameters in PHP: $_server["Http_cookie"]
Parameter name:http_forwarded
Sample reference value: If you use a proxy server will be the IP address of the proxy server, local not easy to take the environment test out the value.
Description: Equivalent to server parameters in PHP: $_server["http_forwarded"]
Parameter name:Http_host
Sample reference value: www.test.com
Description: Equivalent to server parameters in PHP: $_server["Http_host"]
Parameter name:http_proxy_connection
Sample reference value: Information about the network connection agent. Same as the http_forwarded parameter. It is not easy to test the value of the environment locally.
Description: This server information value does not appear to be available in PHP. If the other words may be equivalent to: $_server["Http_proxy_connection"]
Parameter name:http_accept
Sample reference value: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Description: Equivalent to server parameters in PHP: $_server["http_accept"]
Part two: server internals Partial parameters
Parameter name:Document_root
Sample reference value: c:/webroot/t
Description: Equivalent to server parameters in PHP: $_server["Document_root"]
Parameter name:Server_admin
Sample reference value: youemailaddress@gmail.com
Description: Equivalent to server parameters in PHP: $_server["Server_admin"]
Parameter name:server_name
Sample reference value: www.test.com
Description: Equivalent to server parameters in PHP: $_server["SERVER_NAME"]
Parameter name:server_addr
Sample reference value: 127.0.0.1
Description: Equivalent to server parameters in PHP: $_server["SERVER_ADDR"]
Parameter name:Server_port
Sample reference value: 80
Description: Equivalent to server parameters in PHP: $_server["Server_port"]
Parameter name:Server_protocol
Sample reference value: http/1.1
Description: Equivalent to server parameters in PHP: $_server["Server_protocol"]
Parameter name:Server_software
Sample reference value: apache/2.2.11 (WIN32) php/5.2.9-1
Description: Equivalent to server parameters in PHP: $_server["Server_software"]
Part III: Connection & Request partial parameters
Parameter name:REMOTE_ADDR
Sample reference value: 127.0.0.1 is browsing the IP address of the current page user.
Description: Equivalent to server parameters in PHP: $_server["REMOTE_ADDR"]
Parameter name:Remote_host
Sample reference value: 127.0.0.1 is browsing the host name of the current page user. Reverse domain name resolution based on the user's remote_addr
Description: Equivalent to server parameters in PHP: $_server["Remote_host"]
Parameter name:Remote_port
Sample reference value: 2574 (variable value) the port that the user uses when connecting to the server
Description: Equivalent to server parameters in PHP: $_server["Remote_port"]
Parameter name:Remote_user
Sample reference value: null
Description: PHP does not seem to provide the relevant $_server value.
Parameter name:remote_ident
Sample reference value: null
Description: PHP does not seem to provide the relevant $_server value.
Parameter name:Request_method
Sample reference value: GET
Description: Equivalent to server parameters in PHP: $_server["Request_method"]
Parameter name:Script_filename
Sample reference value: c:/webroot/t/share77.html
Description: Equivalent to server parameters in PHP: $_server["Script_filename"]
Parameter name:Path_info
Sample reference value: null
Description: Equivalent to server parameters in PHP: $_request["Path_info"]
Parameter name:query_string
Sample reference value: A=b&c=d&e=f
Description: Equivalent to server parameters in PHP: $_server["query_string"]
Parameter name:Auth_type
Sample reference value: Empty PHP runs in the Apache module mode, and is using the HTTP authentication function, this is the type of authentication
Description: Equivalent to server parameters in PHP: $_server["Auth_type"]
Part IV: date and time partial parameters
Parameter name:Time_year
Sample reference Value: 2009
Description: The server gets the current year value
Parameter name:Time_mon
Sample reference value: 04
Description: The server gets the current month value
Parameter name:Time_day
Sample reference value: 22
Description: The server gets the current day value
Parameter name:Time_hour
Sample reference value: 16
Description: The server gets the hour of the current time
Parameter name:Time_min
Sample reference value: 26
Description: The server gets the minute of the current time
Parameter name:time_sec
Sample reference value: 34
Description: The server gets the current time of the second
Parameter name:Time_wday
Sample Reference value: 3
Description: The server gets the day of the week, from Sunday-Saturday, the number from 0-6
Parameter name: Time
Sample reference value: 20090422162634
Description: The server gets the current time in the format: Month Day time
Part V: specials Partial parameters
Parameter name:api_version
Sample reference value: 20,051,115:21
Description: Apache API version information.
Parameter name:the_request
Sample reference value: Get/share77.html http/1.1
Description: The request value that the browser sends to the server. No other header information is included.
Parameter name:Request_uri
Sample reference value:/share77.html
Description: The resource information requested by the browser.
Parameter name:Request_filename
Sample reference value: c:/webroot/t/share77.html
Description: The physical address of the requested resource on the disk.
Parameter name:Is_subreq
Sample reference value: False
Note: If it is sub-request, it is displayed as true, otherwise false.
Parameter name:HTTPS
Sample reference value: Off
Note: If the connection uses SSL/TLS mode, the value is on, otherwise the value is off, and this parameter is more secure, even when the Mod_ssl module is not loaded.

This article describes the Apache rewrite knowledge, more relevant content please pay attention to the PHP Chinese web.

Related recommendations:

Introduction to PHP Click Captcha Verification Code class

How to use Apache Mod_expires and mod_headers for file caching and mod_deflate compression output

Introduction to the HTML5 history API

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.