-2

I've installed XAMPP on my Mac, and am trying to set up multiple virtual hosts.

I've changed the system hosts file to include the line 127.0.0.1 seo-reports.local and i've added the following to the XAMPP vhosts file

<VirtualHost *>
    DocumentRoot "/Users/Alex/Documents/Software Development/Web/seo-reports"
    ServerName seo-reports.local
    <Directory "/Users/Alex/Documents/Software Development/Web/seo-reports">
    Order allow,deny
    Allow from all
</VirtualHost>

When I go to http://seo-reports.local the file automatically redirects to http://seo-reports.local/xampp - the xampp control page which doesn't seem right.

If i go to an example file, eg: http://seo-reports.local/index.html - i get an error:

Object not found!

The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster. Error 404 seo-reports.local Sun Sep 4 14:02:13 2011 Apache/2.2.14 (Unix) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l PHP/5.3.1 mod_perl/2.0.4 Perl/v5.10.1

0

2 Answers 2

0

You have to delete the entire "xampp/htdocs" folder (well, only what's inside it). Can you post your "error.log" file please?

This is my configuration:

#vHosts Config:

NameVirtualHost *:80

<VirtualHost *:80>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^([^\.]+\.[^\.]+)$
RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]
<Directory "C:/xampp/htroot">
    AllowOverride All
    Options Indexes FollowSymLinks Includes ExecCGI
    Order allow,deny
    Allow from all
</Directory>
    ServerAdmin [email protected]
    DocumentRoot "C:/xampp/htroot/"
    ServerName my-ip
    ServerAlias my-ipaddress
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "C:/xampp/htdocs/"
    ServerName u4ik.us
    ServerAlias www.u4ik.us
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "C:/xampp/htdocs2/"
    ServerName u4ik.info
    ServerAlias www.u4ik.info
</VirtualHost>
4
  • I'm a bit confused. I don't think I should need to delete the contents of that file because I'm not using it as the directory to store my files.
    – Alex coady
    Sep 4, 2011 at 16:42
  • You need the "Name virtual host" part, and properly formatting the vHost directives/tags. Try also using direct paths to the files... "C:/xampp/..." or "C:/users/user/docs/path/to/pages/" and remember the trailing slash.
    – U4iK_HaZe
    Sep 4, 2011 at 16:56
  • Yeah, that bit's there, I just included the individual config. Every single config I add just seems to revert to the default localhost one, any idea why?
    – Alex coady
    Sep 4, 2011 at 17:01
  • What are you using? Xampp? Your config should never "change" by itself unless you have syntax errors.
    – U4iK_HaZe
    Sep 5, 2011 at 1:46
0

To fix this you need to uncomment the include directive:

# Virtual hosts
# Include etc/extra/httpd-vhosts.conf

in /opt/lampp/etc/httpd.conf

Another way to debug your vhosts file is to run:

/opt/lampp/bin/httpd -S 

If you do not see your vhosts being parsed you have not uncommented the above Include Directive

Not the answer you're looking for? Browse other questions tagged .