Answers:
对于初学者,这是您应该如何编写* .conf文件的方法:
NameVirtualHost *:80
<VirtualHost *:80 >
ServerName gw.myserver.net
DocumentRoot "C:\Program Files\MyCompany\myserver\Web"
DirectoryIndex index.html index.php
RewriteLog "logs\rewritelog.txt"
RewriteLogLevel 3
<Directory "C:\Program Files\ MyCompany\ myserver\Web">
AddDefaultCharset UTF-8
Order Deny,Allow
Allow from all
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^gw\. myserver\.net$
RewriteRule !^(login|index.php) http://pmmenu. myserver\.net%{REQUEST_URI}$1 [L,R=301]
# we check if the .html version is here (caching)
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
# no, so we redirect to our front web controller
RewriteRule ^(.*)$ index.php [QSA,L]
</Directory>
</VirtualHost>
您需要在虚拟主机或服务器配置中启用重写日志
RewriteLog "/usr/local/var/apache/logs/rewrite.log"
参见http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewritelog
您可以Rewrite
使用RewriteLog
指令配置专门用于处理的日志文件。可以使用选择日志量RewriteLogLevel
。