VirtualHost problem
Can someone tell me why I can't view my index.php from the subdir /oorbellenboutique/
?
It shows http:// www.oorbellenboutique.nl/startpagina/index.php
, but it must be the index.php from f:/inetpub/wwwroot/oorbellenboutique
The correct URL is: http:// www.oorbellenboutique.nl/index.php
My DNS is:
A *.oorbellenboutique.nl → 83.87.163.224
A oorbellenboutique.nl → 83.87.163.224
CNAME www.oorbellenboutique.nl → oorbellenboutique.nl
My URL is: http://www.oorbellenboutique.nl
I'm running Apache 2.x
NameVirtualHost 192.168.0.199:80
NameVirtualHost 192.168.0.199:443
<VirtualHost 192.168.0.199:80 192.168.0.199:443>
ServerName oorbellenboutique.nl
ServerAlias www.oorbellenboutique.nl
DocumentRoot f:/inetpub/wwwroot/oorbellenboutique
RewriteEngine On
KeepAlive Off
DocumentRoot "f:/inetpub/wwwroot"
<Directory f:/inetpub/wwwroot/oorbellenboutique>
DirectoryIndex index.php
Order deny,allow
Allow from all
</Directory>
RewriteCond %{HTTP_HOST} ^(?:www\.)?oorbellenboutique\.nl$
ReWriteRule ^(.*) /oorbellenboutique/$1
</virtualhost>
This works but the URL is now:
http:// www.oorbellenboutique.nl/oorbellenboutique/index.php
How can I make the URL shorter like:
http:// www.oorbellenboutique.nl/index.php
NameVirtualHost 192.168.0.199:80
NameVirtualHost 192.168.0.199:443
< VirtualHost 192.168.0.199:80 192.168.0.199:443>
ServerName www.oorbellenboutique.nl
ServerAlias *.oorbellenboutique.nl oorbellenboutique.nl
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(?:www.)?oorbellenboutique.nl$
<Directory f:/inetpub/wwwroot/oorbellenboutique>
DirectoryIndex index.html index.php
开发者_如何学编程 Order deny,allow
Allow from all
</Directory>
RewriteRule ^/$ /oorbellenboutique/ [R]
< /virtualhost>
Try adding a RewriteBase directive immediately following the RewriteEngine directive:
RewriteBase f:/inetpub/wwwroot
That is not the same as DocumentRoot for functionality -- it is needed for mod_rewrite.
精彩评论