Page 1 of 1

mod_rewrite and virtualhost

PostPosted: 07. January 2010 17:03
by bf69
Hi all,

I've been using Xampp for some time now, and are very happy with it. I use it to develop websites locally.

Today I changed the settings to allow virtualhost-redirection. That way I want to prevent the renaming of folders to htdocs constantly if I want to change the website I am working on. For the DNS I use SimpleDNSPlus. This is set up so it redirects all domains ending with .dev to 127.0.0.1.

Then I enables virtualhost in httpd.conf and entered the following section in httpd-vhosts.conf:
Code: Select all
<VirtualHost *:80>
   VirtualDocumentRoot "D:/Websites/%-2+"
    ServerName %-2+.dev
    ServerAlias www.%-2+.dev
   <Directory "D:/Websites/%-2+">
      Options FollowSymLinks
      AllowOverride All
      Order allow,deny
      Allow from all
   </Directory>
</VirtualHost>


This works absolutely fine. The only thing is that when I use URL-rewriting in my .htaccess I get a 403-error...

So: seperatly mod_rewrite and virtualhost work as they should, but combined they break. Anybody any idea? I'm using version 1.6.0a

Re: mod_rewrite and virtualhost

PostPosted: 20. February 2010 09:29
by bf69
I'm still struggling to get this to work, but I can't figure out what is the exact problem...

Anybody any idea?

Re: mod_rewrite and virtualhost

PostPosted: 20. February 2010 12:02
by Nobbie
For redirections in combination with mod_vhost_alias (i.e. VirtualDocumentRoot) you *MUST* specify "UseCanonicalName Off" inside the VirtualHost-Configuration (default Value is "On").

Read the doc about VirtualDocumentRoot and UseCanonicalName.

Re: mod_rewrite and virtualhost

PostPosted: 21. February 2010 18:32
by bf69
Hi Nobbie, thanks for your reaction.

I added "UseCanonicalName Off" to the virtualhost configuration, but I still get 403-errors after restarting apache.

my virtualhost configuration now looks like this:
Code: Select all
<VirtualHost *:80>
   UseCanonicalName Off
   VirtualDocumentRoot "D:/Websites/%-2+"
    ServerName %-2+.dev
    ServerAlias www.%-2+.dev
   <Directory "D:/Websites/%-2+">
      Options FollowSymLinks
      AllowOverride All
      Order allow,deny
      Allow from all
   </Directory>
</VirtualHost>