目的隐藏源路径后剩下的路径转到需要路径,如:打开gonline.yesky.com显示首页为yesky.comic.gonline.com/comic页
打开apache的proxy_http模块(也打开了proxy模块,依赖关系):
a2enmod proxy
a2enmod proxy_http
配置proxy.conf
<IfModule mod_proxy.c> #turning ProxyRequests on and allowing proxying from all may allow #spammers to use your proxy to send email. ProxyRequests Off <Proxy 10.50.21.140:8080> # AddDefaultCharset off Order deny,allow #Deny from all Allow from all #Allow from .example.com </Proxy> # Enable/disable the handling of HTTP/1.1 "Via:" headers. # ("Full" adds the server version; "Block" removes all outgoing Via: headers) # Set to one of: Off | On | Full | Block # ProxyVia On </IfModule> 配置VirtualHost <VirtualHost *:80> ServerAdmin [email protected] DirectoryIndex index.php index.html index.htm DocumentRoot /opt/www_data/yesky.comic.gonline.com/public_html ServerName gonline.yesky.com <Directory /opt/www_data/yesky.comic.gonline.com/public_html> Options Indexes FollowSymLinks Multiviews AllowOverride All </Directory> RewriteEngine On RewriteCond %{REQUEST_URI} ^/$ RewriteRule ^/$ http://yesky.comic.gonline.com/comic/ [P] RewriteCond %{REQUEST_URI} !^/$ RewriteRule ^/comic/(.+)$ http://yesky.comic.gonline.com/comic/$1 [R=301,L] RewriteCond %{REQUEST_URI} !^/comic/|^/images/|^/src/|^/comic$|^/index.php/comic/|^/index.php/comic$|crossdomain.xml|/tasks/|/gce/|/award/|/toolbar/|/cartoon/|/book/|/search/ RewriteRule ^/(.*) http://www.gonline.com/$1 [R=301,L] </VirtualHost> <VirtualHost *:80> ServerAdmin [email protected] DirectoryIndex index.php index.html index.htm DocumentRoot /opt/www_data/yesky.comic.gonline.com/public_html ServerName yesky.comic.gonline.com <Directory /opt/www_data/yesky.comic.gonline.com/public_html> Options Indexes FollowSymLinks Multiviews AllowOverride All </Directory> ErrorLog /opt/www_data/nfs_from_10/logs/error_yesky.comic.gonline.com.log CustomLog /opt/www_data/nfs_from_10/logs/access_yesky.comic.gonline.com.log combined RewriteEngine On RewriteCond %{REQUEST_URI} !^/comic/|^/images/|^/src/|^/comic$|^/index.php/comic/|^/index.php/comic$|crossdomain.xml|/tasks/|/gce/|/award/|/toolbar/|/cartoon/|/book/|/search/ RewriteRule ^/(.*) http://www.gonline.com/$1 [R=301,L] </VirtualHost> |
声明: 此文观点不代表本站立场;转载须要保留原文链接;版权疑问请联系我们。