URL redirection for Apache server

Source: Internet
Author: User

The front-end time for the entire Apache redirection function, here to record a bit.

First, install Apache

Windows version of the official download installation files httpd-2.2.21-win32-x86-openssl-0.9.8r, select the installation directory, directly installed just fine.

After installation, services and the taskbar will have Apache service appear.

Second, the Apache directory structure

Mainly conf configuration information folder and Modules function module folder.

Main configuration files:

C:\Program Files (x86) \apache software foundation\apache2.2\conf\httpd.conf,

C:\Program Files (x86) \apache software foundation\apache2.2\conf\extra\httpd-vhosts.conf.

Third, open the virtual host configuration

Modify the following configuration to add a different host to the httpd-vhosts.conf

# Virtual Hosts
Include conf/extra/httpd-vhosts.conf

<VirtualHost*:8080>ServerAdmin [email protected] documentroot "C:/Program Files (x86)/apache software Foundation/apache2.2/htdocs" ServerName dummy-host.englishnet serveralias www.dummy-host.englishnet errorlog "Logs/dummy-host.englishnet-erro R.log "Customlog" Logs/dummy-host.englishnet-access.log "common Rewriteengine on rewriterule/index3.html htt P://passport.cnblogs.com/user/signin [R]</VirtualHost><VirtualHost*:8090>ServerAdmin [email protected] documentroot "e:/asoft/apache/apachetest" Aspnetmount/"e:/asoft/apache/a Pachetest "ServerName dummy-host2.englishnet errorlog" Logs/dummy-host2.englishnet-error.log "CustomLog" logs /dummy-host2.englishnet-access.log "Common<Directory"E:/asoft/apache/apachetest">options followsymlinks execcgi options Indexes followsymlinks includes execcgi allowoverride Al L Order Allow,deny allow from all DirectoryIndex default.aspx index.html</Directory>rewriteengine on Rewriterule ^/postdata.ashx$ http://testbx.palmyou.com/v7s-insurance-wap/individualend /meiyawxpay [r,p] #/revertdata.ashx</VirtualHost>
View Code

Iv. Apache support for ASP.

2.2 The following versions are required to install the. NET feature module MOD_ASPDOTNET-2.2.0.2006-SETUP-R2, which supports versions under. NET 4.

You need to add the following aspdotnet_module configuration in httpd.conf:

#asp. Netloadmodule aspdotnet_module "modules/mod_aspdotnet.so" AddHandler ASP. CS csproj licx REM resources resx soap vb vbproj vsdisco webinfo<IfmoduleMod_aspdotnet.cpp># Mount The ASP. Example Application#aspnetmount/active "C:/Program Files (x86)/apache software Foundation/apache 2.2/htdocs "# Map all requests For/active to the application Files#alias/active" C:/Program files (x86)/apache software F Oundation/apache2.2/htdocs "# Allow ASP. Scripts to being executed in the active example#<Directory"C:/Program Files (x86)/apache software Foundation/apache2.2/htdocs">#Options followsymlinks execcgi#order allow,deny#allow from All#directoryindex default.htm default.aspx#</Directory># for all virtual ASP webs, we need the aspnet_client files# to serve the client-side helper scripts. aliasmatch/aspnet_client/system_web/(\d+) _ (\d+) _ (\d+) _ (\d+)/(. *) "c:/windows/microsoft.net/framework/v$1.$2.$3/ Asp. Netclientfiles/$4 "<Directory"C:/windows/microsoft.net/framework/v*/asp.netclientfiles">Options followsymlinksorder Allow,denyallow from all</Directory></Ifmodule>
View Code


Five, redirect function

To turn on Agent module:

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule Proxy_http_module modules/mod_proxy_http.so

Post redirection p, URL redirection r:

Rewriteengine on
Rewriterule ^/postdata.ashx$ http://www.aaaa.com/v7s-wap/individualend/ddddd [r,p]

Reverse proxy:

#反向代理设置
Proxypass/proxy Http://www.proxypass.com/proxy
Proxypassreverse/proxy Http://www.proxypass.com/proxy

URL redirection for Apache server

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.