Windows Apache httpd-vhosts.conf
<VirtualHost *:80> DocumentRoot "D:\wamp\www" ServerName localhost </VirtualHost> <VirtualHost *:80> DocumentRoot "D:\wamp\www\blog\public" ServerName blog.my </VirtualHost> //HTTPS双向认证 <VirtualHost *:80> DocumentRoot "D:/wamp/www/www.newdefend.com" ServerName my.newdefend.com </VirtualHost> <VirtualHost *:443> DocumentRoot "D:/wamp/www/www.newdefend.com" ServerName my.newdefend.com ErrorLog "D:/wamp/www/logs/error.log" TransferLog "D:/wamp/www/logs/access.log" SSLEngine on SSLCertificateFile "D:/wamp/bin/apache/apache2.4.9/bin/server.crt" SSLCertificateKeyFile "D:/wamp/bin/apache/apache2.4.9/bin/server.key" SSLCACertificateFile "D:/wamp/bin/apache/apache2.4.9/bin/root.crt" SSLVerifyClient require SSLVerifyDepth 10 </VirtualHost> //CI框架,my.lvs.com域名直接指向入口文件lvs。也可以用.htaccess文件实现rewrite功能 <VirtualHost *:80> ServerAdmin xuxu ServerName my.lvs.com DocumentRoot "D:/wamp/www/cs_20160630" ErrorLog "logs/lvs.log" CustomLog "logs/lvs.log" combined <Directory "D:/wamp/www/cs_20160630"> Options FollowSymlinks Indexes AllowOverride All Order allow,deny Allow from all Require all granted RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ lvs.php [L,E=PATH_INFO:$1] </Directory> </VirtualHost> .htaccess常用格式 <IfModule mod_rewrite.c> RewriteEngine On # Handle Front Controller... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] </IfModule>