Apache - 模块 - mod_rewrite - RewriteCond - 以域名为重写条件

来源:互联网 发布:java iso8601时间转换 编辑:程序博客网 时间:2024/04/29 11:43

Apache - 模块 - mod_rewrite - RewriteCond - 以域名为重写条件

虚拟主机绑定了两个域名,假设为www.a.com和www.b.com,希望访问www.a.com时按正常方式处理,访问www.b.com时显示/b/index.html的内容。

[示例]

<IfModule rewrite_module>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.b.com$
RewriteRule .* /b/index.html [L]
</IfModule>

[Apache - 关键词]

apache

[Apache - 官方网站]

http://httpd.apache.org/

[Apache - 相关论坛]

http://groups.google.com/group/alt.apache.configuration

[Apache - 下载]

http://httpd.apache.org/download.cgi

[Apache - 相关软件]

10-Strike.Log-Analyzer.v1.5

[Apache - 模块 - mod_rewrite - 关键词]

httxt2dbm
mod_rewrite
ornext
RewriteBase
RewriteCond
RewriteEngine
RewriteLog
RewriteLogLevel
RewriteMap
RewriteRule

[Apache - 模块 - mod_rewrite - 常见用途]

改变查询参数的设定位置

[Apache - 模块 - mod_rewrite - 标记]

RewriteLog, 设置重写引擎日志的文件名

[Apache - 模块 - mod_rewrite - RewriteCond重写条件]

通过检查HTTP_REFERER避免静态图片盗链对性能有严重影响

[Apache - 模块 - mod_rewrite - RewriteRule重写规则]

匹配任意字符串时,可以借助正则表达式的灵活特性

[Apache - 模块 - mod_rewrite - 常见问题]

RewriteRule中的正则表达式需要考虑是否要加上^(匹配字符串开头)

RewriteRule中的正则表达式需要考虑是否要对.转义(匹配任意字符还是仅匹配.字符)

RewriteRule中的R标记用于发送重定向

与PHP集成时不需要对$_GET额外处理

[Apache - 模块 - mod_alias - 常见问题]

RedirectMatch用于简单的重定向
原创粉丝点击