<VirtualHost 106.888.888.88:80> ServerAdmin tom@xxxxx.com DocumentRoot "/opt/app/php/xxxxx.img" ServerName img.xxxxx.com ServerAlias img.xxxxx.com ErrorLog "logs/img.xxxxx.com-error.log" CustomLog "/etc/httpd/logs/img.xxxxx.com.access.log" combined DirectoryIndex index.php index.html index.htm <Directory "/opt/app/php/xxxxx.img"> Options FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory> <Directory "/opt/app/php/xxxxx.img"> <FilesMatch ".(php|asp|jsp)$"> Deny from all </FilesMatch> </Directory> RewriteEngine On RewriteCond %{HTTP_REFERER} !^http://xxxxx.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://xxxxx.com$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.xxxxx.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.xxxxx.com$ [NC] RewriteRule .*\.(gif|jpg|png|swf)$ http://www.xxxxx.com/nolink.jpg [R,NC] </VirtualHost>
301重定向,老域名轉向新域名,保持域名權重:
php
<VirtualHost 192.168.1.12:80> ServerAdmin tom@tom.com ServerName toooom.com ServerAlias www.toooom.com RedirectMatch Permanent ^/(.*) http://www.haolianduo.com/$1 </VirtualHost>
<VirtualHost 106.xxx.xx.xx:80> ServerAdmin tom@tom.com DocumentRoot "/opt/app/php/xxxxx.info" ServerName info.xxxxx.com ServerAlias info.xxxxx.com ErrorLog "logs/info.xxxxx.com-error.log" CustomLog "/etc/httpd/logs/info.xxxxx.com.access.log" combined DirectoryIndex index.php index.html index.htm <Directory "/opt/app/php/xxxxx.info"> Options FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory> <Directory "/opt/app/php/xxxxx.info/uploads"> <FilesMatch ".(php|asp|jsp)$"> Deny from all </FilesMatch> </Directory> <Directory "/opt/app/php/xxxxx.info/data"> <FilesMatch ".(php|asp|jsp)$"> Deny from all </FilesMatch> </Directory> </VirtualHost>