mod_rewrite and virtualhost

Problems with the Windows version of XAMPP, questions, comments, and anything related.

mod_rewrite and virtualhost

Postby bf69 » 07. January 2010 17:03

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
bf69
 
Posts: 5
Joined: 07. January 2010 16:56

Re: mod_rewrite and virtualhost

Postby bf69 » 20. February 2010 09:29

I'm still struggling to get this to work, but I can't figure out what is the exact problem...

Anybody any idea?
bf69
 
Posts: 5
Joined: 07. January 2010 16:56

Re: mod_rewrite and virtualhost

Postby Nobbie » 20. February 2010 12:02

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.
Nobbie
 
Posts: 13182
Joined: 09. March 2008 13:04

Re: mod_rewrite and virtualhost

Postby bf69 » 21. February 2010 18:32

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>
bf69
 
Posts: 5
Joined: 07. January 2010 16:56


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 134 guests