您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

apache如何实现域名转发

2024/6/5 16:32:59发布23次查看
apache安装后,如果想再添加模块,往往不想重新安装一次,再者,我在安装中发现,并不是安装文件中所有的modules都会被默认安装,这次我添加转发模块的过程中,遇到一些问题,为了以后不走弯路,特地记录下来。
端口转发功能
#开启 rewriteengine on rewritecond %{request_method} ^(trace|track) rewriterule .* - [f]
#转发之后地址的域名不转向到ip和端口 #rewritecond %{request_method} !^post$ rewritecond %{http_host} ^xx.com.cn rewriterule ^/(.*) http://xxx.xxx.xxx.xxx:9100/$1 [nc,ne,r=301,p]
#转发之后地址会跳转到ip和端口 rewritecond %{http_host} ^c.xx.com.cn rewriterule ^/(.*) http://xxx.xxx.xxx.xxx:8001/$1 [nc,ne] rewriterule ^/a/b.html http://xxx.xxx.xxx.xxx:8002/a/b.html [nc,p]
#例如 rewriteengine on rewritecond %{request_method} ^(trace|track) rewriterule .* - [f] rewritecond %{http_host} ^m.abc.com.cn rewriterule ^/(.*) http://xxx.xxx.xxx.xxx:8001/$1 [nc,ne] <virtualhost *:8001> documentroot "/var/www/html/mobile" <directory "/var/www/html/mobile"> options followsymlinks includesnoexec indexes directoryindex index.html index.htm index.php allowoverride all order allow,deny allow from all </directory> </virtualhost>
更多apache的相关技术文章,请访问apache教程栏目进行学习!
以上就是apache如何实现域名转发的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product