Your ServerName is the name that goes in the HOSTS file as well as your ServerAlias (Sub-domain).
- Code: Select all
127.0.0.1 localhost
127.0.0.1 clickbasics
127.0.0.1 subdomainname.domain.co.uk
Edit:
BTW the above will allow access from Localhost for developing your sites locally and so you should not put your DNS configured names in here or you won't be able to connect via the Internet only via local server.
You have set your DNS correctly, I assume, so when connected to the Internet your ServerName should be the same as you configured your DNS or you won't be able to connect to the XAMPP Apache server.
Example:
ServerName domainname.co.uk
ServerAlias
www.domainname.co.ukSubdomain
Servername subdomain.domainname.co.uk
Remeber to frequently clear your browser's cache when developing your web site's - your browser cache can be your worst enemy.
For redirecting, in your first post, you may like to use a .htaccess file in the main domain root web folder or if you don't want to serve the main domain name but just the forum as your main site then change the ServerName to
www.domainname.co.uk with the DocumentRoot set to the forums folder - more on that when we have you up and running as you intend.
/EDIT.
Your vhost using the Glitzi example may now look like this:
- Code: Select all
<VirtualHost *:80>
ServerName clickbasics
ServerAlias subdomainname.domain.co.uk
DocumentRoot "C:/xampp/htdocs/subdomainname.domain.co.uk"
ServerAdmin webmaster@localhost
<Directory "C:/xampp/htdocs/subdomainname.domain.co.uk">
IndexOptions +FancyIndexing NameWidth=*
Options Indexes Includes FollowSymLinks ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
http://clickbasicswill go to the same folder as
http://subdomainname.domain.co.ukIn the above configuration.
If you want
clickbasics and
subdomainname.domain.co.uk to go to different folders and hence different content then you have to create your vhosts containers like so, again using Glitzi's example:
- Code: Select all
NameVirtualHost *:80
<VirtualHost *:80>
ServerName localhost
DocumentRoot "C:/xampp/htdocs"
ServerAdmin webmaster@localhost
</VirtualHost>
<VirtualHost *:80>
ServerName clickbasics
DocumentRoot "C:/xampp/htdocs/clickbasics"
ServerAdmin webmaster@localhost
<Directory "C:/xampp/htdocs/clickbasics">
IndexOptions +FancyIndexing NameWidth=*
Options Indexes Includes FollowSymLinks ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName subdomainname.domain.co.uk
DocumentRoot "C:/xampp/htdocs/subdomainname.domain.co.uk"
ServerAdmin webmaster@localhost
<Directory "C:/xampp/htdocs/subdomainname.domain.co.uk">
IndexOptions +FancyIndexing NameWidth=*
Options Indexes Includes FollowSymLinks ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
http://clickbasics - will go to the content in the htdocs\clickbasics folder
http://subdomainname.domain.co.uk - will go to the content in htdocs\subdomainname.domain.co.uk
Normally the subdomain folder would be in the main ServerName folder, so in your case the server tree should perhaps be
htdocs\clickbasics\subdomainname.domain.co.uk with the necessary changes made to the vhosts containers above - this is not required but is the norm on a commercial hosting server as the server looks in the main folder for the subdomain.
The
<Directory> folder should be the same name you set for the
DocumentRoot folder.
You say you put the VirtualHost configuration in:
C:\xampp\apache\conf\extra\httpd-xampp.conf
Should perhaps be moved to:
C:\xampp\apache\conf\extra\httpd-vhosts.conf
If you can't restart Apache as your error suggests then the configuration edits for your server will not be recognized.
You have to solve the restart issue first.
Try this:
In your XAMPP Control Panel click on Apache -->
Stop.
Un-check the Apache
Svc box.
Click
OK to stop the service
Right click on the Windows Task Bar and select
Task Manager and click on the
Processes tab.
If you see any
apache.exe files listed then select (highlight) each in turn and select
End Process button.
Click
Yes each time requested.
Close the Task Manager
Now back to the XCP and select Apache -->
Start - do not check the
Svc at this point.
Now see if Apache has started - You can Stop and Start a few times to make sure all is now working correctly.
Post back if you still get the error as you may have other issues perhaps.