Here is my virtual host :
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName policy.domain.com
ServerAlias www.policy.domain.com
DocumentRoot /policy
ErrorLog /policy/error.log
CustomLog /policy/custom.log combined
<Directory /policy/>
Options +IncludesNOEXEC
AllowOverride None
Order allow,deny
allow from all
# redirect non www to www
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [L]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
</Directory>
</VirtualHost>
I have tried various settngs, but pages at www doesn't seem to appear. Though, the php removal works well when I remove non-www to www condition. To be specific, apache is redirect non www to www but at www it shows server not found error.