配置DocumentRoot
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | # 定义变量 Define WEB_ROOT "E:\workspace\php\MonBook\website" DocumentRoot ${WEB_ROOT} <Directory ${WEB_ROOT}> # # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # The Options directive is both complicated and important. Please see # for more information. # Options Indexes FollowSymLinks Includes ExecCGI # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # AllowOverride FileInfo AuthConfig Limit # AllowOverride All # # Controls who can get stuff from this server. # Require all granted </Directory> |
二级目录解析
1 2 3 4 5 6 | Alias /simple_blog "E:\workspace\php\simple_blog" <Directory "E:\workspace\php\simple_blog"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Require all granted </Directory> |
二级域名解析
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | <VirtualHost local-wxadm-test.dymfilm.com:80> ServerName local-wxadm-test.dymfilm.com ErrorLog "D:\web_root\tmp\local-wxadm-test.dymfilm.com.log" CustomLog "D:\web_root\tmp\local-wxadm-test.dymfilm.com-custom.log" combined DocumentRoot "E:\workspace\php\weixin_backend\wxadm" <Directory "E:\workspace\php\weixin_backend\wxadm"> # AllowOverride All # Deprecated # Order Allow,Deny # Deprecated # Allow from all # Deprecated # --New way of doing it #Options Indexes FollowSymLinks Includes ExecCGI Options All AllowOverride All Require all granted # 定义URL重定向规则,不是文件,则指向index.php,源自Php的Yaf框架 # 也可以配置到网站源码的.htaccess文件中 RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule .* index.php </Directory> </VirtualHost> |