RewriteEngine on
RewriteCond %{REQUEST_URI} ^campus.51job.com/btmu/
RewriteRule campus.51job.com/btmu/(.*) {SERVER_NAME}/$1 [R]
RedirectMatch permanent ^/(.*)$ $1
ServerAlias webhosting-world.com
ServerAdmin admin@webhosting-world.com
ServerName
DocumentRoot /path/to/webhosting-world/root
RewriteEngine On #
Redirect webhosting-world.com/forums to bbs.wbhw.com
RewriteCond %{REQUEST_URI} ^/forums/
RewriteRule /forums/(.*) $1
[R=permanent,L] #
Redirect webhosting-world.com to wbhw.com
RewriteCond %{REQUEST_URI} !^/forums/
RewriteRule /(.*) $1 [R=permanent,L]
URL重定向 例子一:
1.>
2.> ?username=yyy 的功能
RewriteEngine On
RewriteCond %{HTTP_HOST} ^
RewriteCond %{REQUEST_URI} !^user\.php$
RewriteCond %{REQUEST_URI} \.php$
RewriteRule (.*)\.php$ $1/ [R]
RewriteCond %{HTTP_HOST} !^
RewriteRule ^(.+) %{HTTP_HOST} [C]
RewriteRule ^([^\.]+)\.zzz\.com ?username=$1
例子二:
/type.php?typeid=* --> /type*.html
/type.php?typeid=*&page=* --> /type*page*.html
RewriteRule ^/type([0-9]+).html$ /type.php?typeid=$1 [PT]
RewriteRule ^/type([0-9]+)page([0-9]+).html$ /type.php?typeid=$1&page=$2 [PT]
5.使用Apache的URL Rewrite配置多用户虚拟服务器 要实现这个功能,首先要在DNS服务器上打开域
名的泛域名解析(自己做或者找域名服务商做)。rewrite规则
比如,我就把 *.semcase.com和 *.semcase.cn全部解析到了我的这台Linux Server上。
然后,看一下我的Apache中关于*.semcase.com的虚拟主机的设定。
#*.com,*.osall.net ServerAdmin webmaster@semcase.com
DocumentRoot /home//.semcase.com
ServerName dns.semcase.com
ServerAlias dns.semcase.com semcase.com semcase.net *.semcase.com *.semcase.net
CustomLog /var/log/httpd/osa/access_log.log" common
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-24370-3.html
不一样的感觉
好费电啊
早上喝两包压压惊