<!-- [if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:PunctuationKerning/>
<w:DrawingGridVerticalSpacing>7.8 磅</w:DrawingGridVerticalSpacing>
<w:DisplayHorizontalDrawingGridEvery>0</w:DisplayHorizontalDrawingGridEvery>
<w:DisplayVerticalDrawingGridEvery>2</w:DisplayVerticalDrawingGridEvery>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:Compatibility>
<w:SpaceForUL/>
<w:BalanceSingleByteDoubleByteWidth/>
<w:DoNotLeaveBackslashAlone/>
<w:ULTrailSpace/>
<w:DoNotExpandShiftReturn/>
<w:AdjustLineHeightInTable/>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:UseFELayout/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
</w:WordDocument>
</xml><![endif]--><!-- [if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" LatentStyleCount="156">
</w:LatentStyles>
</xml><![endif]-->
<!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"\@宋体";
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
mso-pagination:none;
font-size:10.5pt;
mso-bidi-font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:宋体;
mso-font-kerning:1.0pt;}
/* Page Definitions */
@page
{mso-page-border-surround-header:no;
mso-page-border-surround-footer:no;}
@page Section1
{size:595.3pt 841.9pt;
margin:2.0cm 2.0cm 2.0cm 2.0cm;
mso-header-margin:42.55pt;
mso-footer-margin:49.6pt;
mso-paper-source:0;
layout-grid:15.6pt;}
div.Section1
{page:Section1;}
-->
<!-- [if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";
mso-ansi-language:#0400;
mso-fareast-language:#0400;
mso-bidi-language:#0400;}
</style>
<![endif]-->
1
安装
tomcat/apache
2
下载
jk.so,
具体版本请根据需要,不再多说
3
关键是配置
httpd.conf
#
去掉这个前面的
#,
启用它
LoadModule rewrite_module
modules/mod_rewrite.so
#
启用
jk,
同时配置参数
LoadModule
jk_module
modules/mod_jk.so
JkWorkersFile
D:/Apache2.2/conf/workers.properties
JkLogFile
d:/Apache2.2/logs/mod_jk.log
JkLogLevel
info
#JkLogLevel
debug
JkLogStampFormat
"[%a
%b
%d
%H:%M:%S
%Y]
"
JkOptions
+ForwardKeySize
+ForwardURICompat
-ForwardDirectories
JkRequestLogFormat
"%w
%V
%T"
JkMount
/servlet/*
myloadbalancer
JkMount
/*.jsp
myloadbalancer
#
虚拟主机,这里模拟了
a.test.com
和
b.test.com
以及
a.tst.com/blog
的调用
<VirtualHost _default_:80>
ServerAdmin yourmail@domain.com
DocumentRoot D:\Apache2.2\htdocs
ServerName all-sites
ErrorLog logs/all-sites-error.log
CustomLog logs/all-sites-access.log common
RewriteEngine On
#
下面三行实现动态解析
RewriteCond %{HTTP_HOST}
^[a-z0-9\-]+\.test\.com$
RewriteRule ^/(.*)$ /%{HTTP_HOST}/$1
RewriteRule ^/([a-z0-9\-]+)\.test\.com/?$
/index.jsp?u=$1 [L,PT]
RewriteRule
^/([a-z0-9\-]+)\.test\.com/blog(/(.*))?$ /blog.jsp?u=$1&$3 [L,PT]
<Directory
"D:\Apache2.2\htdocs">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
workers.properties
worker.list=myloadbalancer
worker.tomcat1.type=ajp13
worker.tomcat1.host=localhost
worker.tomcat1.port=8009
worker.tomcat1.lbfactor=1
worker.myloadbalancer.type=lb
worker.myloadbalancer.balance_workers=tomcat1
worker.status.type=status
server.xml
去掉前后的
<!--
和
-->
启用
8009
端口
<Connector port="8009"
...
说明一下
在
httpd.conf
里面启用了
rewrite_module,
和
mod_jk,
并配置了
与
tomcat
的连接配置。
虚拟主机的配置是关键
ServerName all-sites
可以修改为
ServerName test.com
ServerAlias *.test.com
这样可以明确指定这个虚拟主机负责的域名
urlRewrite
配置部分
*
RewriteCond %{HTTP_HOST} ^[a-z0-9\-]+\.test\.com$
*
RewriteRule ^/(.*)$ /%{HTTP_HOST}/$1
*
RewriteRule ^/([a-z0-9\-]+)\.test\.com/?$ /index.jsp?u=$1 [L,PT]
*
RewriteRule ^/([a-z0-9\-]+)\.test\.com/blog(/(.*))?$ /blog.jsp?u=$1&$3
[L,PT]
第一行,声明这个重写只对主机名
(%{HTTP_HOST})
类似
XXXX.test.com
感兴趣,那个是正则的
第二行,将所有的对此域名的请求进行第一次改写,比如
a.test.com
改成
/a.test.com
把
b.test.com/blog
改成
/b.test/com/blog
第三行,对无参数的访问进行调整
将
/a.test.com
改成
/index.jsp?u=a
第四行,对有参数路径的进行调整
将
/b.test.com/blog
改成
/blog.jsp?u=b
如果还有参数比如
b.test.com/id=3
则最终改写为
/b.test.com/id=3
/blog.jsp?u=b&id=3
剩下的就不多说了!
分享到:
相关推荐
UrlRewriter 实现伪静态
ASP.NET MVC4通过UrlRewriter配置伪静态,在网上都有很多资料,这里主要是把项目中使用到的通过UrlRewriter配置伪静态提取出来,方便自己以后查看,同样对需要该功能的网友提供思路。
UrlRewriter.dll 网页静态化 URL重写 代码实例
最近研究了一下伪静态,网上资料确实是比较多,我经过大量的测试,现整理两种方法进行伪静态 第一种方法需引用UrlRewriter.dll,请参考Web1.config部署 第二种方法需引用Intelligencia.UrlRewriter.dll,请参考Web....
这个是我个人在网上搜集的关于.NET实现页面伪静态的一些资料,以及相关的DLL文件,希望对大家有帮助。
UrlRewriter伪静态文件库
asp.net 伪静态实现和IIS7.0配置(包含UrlRewriter.dll文件) 经本人测试可正常使用
如何隐藏aspx文件格式,变成html,使用asp.net 开发的网页程序,使用URLRewriter.dll 实现静态化,接下来将介绍下具体操作步骤,感兴趣的朋友可以参考下
实现重写的是URLRewriter.dll 如果想分页,则必须使用ActionlessForm.dll
UrlRewriter.dll实现URL重写 以及伪静态
最简单的URL配置,丰富的配置案例,只注意dll和配置文件。是seo的好帮手
net用url重写URLReWriter实现任意二级域名
URLRewriter 源码,微软提倡使用的伪静态工具,个人可以在原有基础上做更改
微软提供的dll URLRewriter实现url 重写
UrlRewriter实现伪静态 地址栏重写,含demo,包含iis7.5错误解决方案
Intelligencia.UrlRewriter 使用方法 简单易懂.一看就会.哈
先导入URLRewriter.dll 然后Web.config修改配置 <section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" /> ~/news/(.[0-9]*)\....
UrlRewriter 伪静态 适合新手开发