Apache Rewrite usage overview

Source: Internet
Author: User
Tags php server reference

1. Open rewrite

sudo a2enmod rewrite

2. Deactivate rewrite

sudo a2dismod rewrite

3. Server environment variables

The environment variable that Apache provides to the Rewirte module is probably 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 PHP server parameters: $_server["Http_user_agent"]

Parameter name: Http_referer

Sample reference value: http://www.test.cn/test.php

Description: Equivalent to PHP server parameters: _server["Http_referer"]

Parameter name: Http_cookie

Sample reference value: ZDEDEBUGGERPRESENT=PHP,PHTML,PHP3

Description: Equivalent to PHP server parameters: $_server["Http_cookie"]

Parameter name: http_forwarded

Sample reference value: If the use of Proxy server will be the IP address of the proxy server, local environment is not easy to test the value.

Description: Equivalent to PHP server parameters: $_server["http_forwarded"]

Parameter name: Http_host

Sample reference value: www.test.com

Description: Equivalent to PHP server parameters: $_server["Http_host"]

Parameter name: http_proxy_connection

Sample reference value: Information about the network connection agent. The same as the http_forwarded parameter. It is not easy to test the value of the environment locally.

Description: PHP does not seem to provide such a server information value. If again, it 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 PHP server parameters: $_server["Http_accept"]

Part II: Server Internals Partial parameters

Parameter name: Document_root

Sample reference value: c:/webroot/t

Description: Equivalent to PHP server parameters: $_server["Document_root"]

Parameter name: server_admin

Sample reference value: youemailaddress@gmail.com

Description: Equivalent to PHP server parameters: $_server["Server_admin"]

Parameter name: server_name

Sample reference value: www.test.com

Description: Equivalent to PHP server parameters: $_server["SERVER_NAME"]

Parameter name: SERVER_ADDR

Sample reference value: 127.0.0.1

Description: Equivalent to PHP server parameters: $_server["SERVER_ADDR"]

Parameter name: Server_port

Sample reference value: 80

Description: Equivalent to PHP server parameters: $_server["Server_port"]

Parameter name: Server_protocol

Sample reference value: http/1.1

Description: Equivalent to PHP server parameters: $_server["Server_protocol"]

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.