Subdomain Name, Can anyone help please

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

Subdomain Name, Can anyone help please

Postby Pete1987 » 23. October 2008 22:06

I am running windows server 2003 atm, i want to add subdomain names in xampp, i have added them to my dns server and domainname provider but i can not find out on how to get xampp to read them.
and also can someone help on how to redirect the domain e.g (www.domainname.co.uk to www.domainname.co.uk/forums)
can someone help me please
thanks pete
Pete1987
 
Posts: 9
Joined: 23. October 2008 21:56

Postby Sharley » 24. October 2008 02:21

Have you set up a virtual host for your domain in .\xampp\apache\conf\extra\httpd-vhosts.conf file?
http://httpd.apache.org/docs/2.2/vhosts/
Try Name-based Virtual Hosts first but do read the other pages as it will all help with your understanding of the subject.

Do a search for more info and examples using Keyword vhost in the XAMPP For Windows forum and the Apache Friends In English category.

A subdomain uses the ServerAlias directive in your vhost container:
http://httpd.apache.org/docs/2.2/mod/co ... erveralias

To redirect a URI you could use a Redirect directive:
http://httpd.apache.org/docs/2.2/mod/mo ... l#redirect

Some reading first then have a go and if you get stuck with your efforts then by all means post back with details of what you have tried and what errors you are getting.

Good luck.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Postby Pete1987 » 24. October 2008 07:30

thanks will give them a go and i'll let you know how i get on
thanks
Pete1987
 
Posts: 9
Joined: 23. October 2008 21:56

Postby wolfshaven » 31. October 2008 04:18

I'm not sure if you have to set it up for windows server 2003 but for some versions of windows require you to edit...

C:\WINDOWS\system32\drivers\etc\hosts

By default there will be
127.0.0.1 localhost

After that you may need to add
127.0.0.1 www.domainname.co.uk

If the additional host names don't get put in there you wont be able to get to them even if virtual hosts is set up correctly.
wolfshaven
 
Posts: 2
Joined: 19. July 2006 21:18
Location: USA

Postby Pete1987 » 17. November 2008 19:28

hi
I have been trying to get my subdomain name in xampp working but still no look,

I have added to my
Code: Select all
C:\WINDOWS\system32\drivers\etc\hosts

127.0.0.1 localhost
127.0.0.1 subdomainname.domainname.co.uk

and i have also edited my
Code: Select all
C:\xampp\apache\conf\extra\httpd-xampp.conf


with

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/subdomainname.domain.co.uk"
ServerAdmin webmaster@localhost
<Directory "C:/xampp/htdocs/subdomain">
IndexOptions +FancyIndexing NameWidth=*
Options Indexes Includes FollowSymLinks ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>


then stoped and restarted xampp by the controll pannel but "ERROR: Apache service not started [-1]
Busy"

and still no luck
has anyone got anymore advice for me where i have gone wrong
thanks in advanced
Pete1987
 
Posts: 9
Joined: 23. October 2008 21:56

Postby glitzi85 » 17. November 2008 19:41

Replace

Code: Select all
<VirtualHost *:80>
ServerName clickbasics
DocumentRoot "C:/xampp/htdocs/subdomainname.domain.co.uk"
ServerAdmin webmaster@localhost
<Directory "C:/xampp/htdocs/subdomain">
IndexOptions +FancyIndexing NameWidth=*
Options Indexes Includes FollowSymLinks ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>


with

Code: Select all
<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>


And make sure the path C:/xampp/htdocs/subdomainname.domain.co.uk exists!
User avatar
glitzi85
 
Posts: 1920
Joined: 05. March 2004 23:26
Location: Dahoim

Postby Pete1987 » 17. November 2008 21:45

thanks for your fast replay
just had another go of what you posted but still no look still can't get it to work and my main domain name cannot be found now either :(
Pete1987
 
Posts: 9
Joined: 23. October 2008 21:56

Postby Sharley » 17. November 2008 21:47

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.uk

Subdomain
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://clickbasics
will go to the same folder as
http://subdomainname.domain.co.uk
In 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.
Last edited by Sharley on 17. November 2008 22:30, edited 2 times in total.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Postby Pete1987 » 17. November 2008 22:29

just a quick question about my sub domain name
can you have a " - " within a subdomain name?
Pete1987
 
Posts: 9
Joined: 23. October 2008 21:56

Postby Sharley » 17. November 2008 22:34

Pete1987 wrote:just a quick question about my sub domain name
can you have a " - " within a subdomain name?
Often permitted but unless essential and to save confusion ask the question is it essential?
Hyphen:
sub-domain.domain.co.uk
Should work if placed in the ServerName or ServerAlias part.
Last edited by Sharley on 17. November 2008 23:02, edited 1 time in total.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Postby Pete1987 » 17. November 2008 22:38

sorry its Hyphened so it would look summit like this -
http://sub-domain.domain.co.uk
Last edited by Pete1987 on 17. November 2008 22:48, edited 1 time in total.
Pete1987
 
Posts: 9
Joined: 23. October 2008 21:56

Postby Sharley » 17. November 2008 22:44

Pete1987 wrote:sorry its Hyphened so it would look summit like this -
http://sub-domain.domain.co.uk
That should be fine.

Hyphens are permitted in a name but not at the beginning or end of the name:

-subdoman.domain.co.uk
or
subdomain-.domain.co.uk
are not permitted but

sub-domain.domain.co.uk
or
sub-domain.main-domain.co.uk
Is fine.

An underscore is not permitted in a main domain name but permitted in a subdomain name:
http://www.querycat.com/faq/ed61cf3d278 ... d0eb333ffe
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: Subdomain Name, Can anyone help please

Postby Pete1987 » 14. December 2008 12:36

i have recently done a bit of an upgrade on the server and now i am running windows server 2007, will there be any different setting that i would need to use now?

thanks Pete
Pete1987
 
Posts: 9
Joined: 23. October 2008 21:56


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 133 guests