Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Server Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 17th August 2007, 22:22
alva alva is offline
Junior Member
 
Join Date: Aug 2007
Posts: 9
Thanks: 1
Thanked 0 Times in 0 Posts
Default htaccess how to make www.subdomain paraller to subdomain?

Please tell me what code is necessary to write in htaccess file to make

www.subdomain.domain.com same as subdomain.domain.com

problem is that my blog system understand only subdomain.domain.com but if user writes www by mistake system shows url error. So I'm sure there must be a code that will make www.xxx.domain.com same as xxx.domain.com for all registered domains.
Reply With Quote
Sponsored Links
  #2  
Old 18th August 2007, 12:42
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,744 Times in 2,577 Posts
Default

You must add
Code:
ServerAlias www.subdomain.domain.com
to the vhost configuration in Apache (not .htaccess). And of course, www.subdomain.domain.com must point to the correct IP address in DNS.
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #3  
Old 18th August 2007, 22:10
alva alva is offline
Junior Member
 
Join Date: Aug 2007
Posts: 9
Thanks: 1
Thanked 0 Times in 0 Posts
Default

I want this to be used for all automatically created subdomains not just for one or two. my domain is www.domain.com how to do this?! and at the same time I do not want mistake like www.www.domain.com to be the same as www.domain.com This is the only let's say subdomain that I do not want to be forwarded anywere to allow people go to the main page without problem and register for new blogs.
Reply With Quote
  #4  
Old 19th August 2007, 14:51
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,744 Times in 2,577 Posts
Default

Quote:
Originally Posted by alva
I want this to be used for all automatically created subdomains not just for one or two. my domain is www.domain.com how to do this?!
You can add as many subdomains to the ServerAlias line as you like, e.g.
Code:
ServerAlias sub1.example.com sub2.example.com sub3.example.com
Quote:
Originally Posted by alva
and at the same time I do not want mistake like www.www.domain.com to be the same as www.domain.com This is the only let's say subdomain that I do not want to be forwarded anywere to allow people go to the main page without problem and register for new blogs.
You'd have to filter that out yourself, e.g. with a script.
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #5  
Old 8th September 2007, 00:46
goitalone goitalone is offline
Junior Member
 
Join Date: Sep 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Need help understanding and configuring home web server virtualhost & subdomains

I have yet to figure out or understand exactly how to make a top level subdomain work to display something other than my regular website.

For example:

I want subdomain.domain.com to display an entirely new site from a different folder, but right now this is the path to ALL of my regular site (forum) content:

D:/Web/Server/Apache2/htdocs

I am using my own domain I signed up and paid for up for at www.netfirms.com and forwarded my info to www.freedns.afraid.org to get my domain to work on my webserver from home (at least I think I had to do it that way...still not sure)

At Netfirms, I can change the A records, CNAME's etc. there but I am not sure if I need to configure anything at Netfirms as well as at freedns.org, or just at freedns.org...(or if I can do it all from Netfirms)

I don't know exactly what I am doing wrong, but I can't seem to get it to work right.

I made a domain test subdomain name with A record at freedns (CNAME wouln't work)

gay.sda-n-friends.com

I added this to Apache:

<VirtualHost *:80>
# ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /gay
ServerName gay.sda-n-friends.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

I made a folder for a new site.

Tried playing around with .htaccess configurations since that is new to me too and that didn't help.

Scoured the net looking for an answer, couldn't quite find one that worked for me....nothing worked.

Can someone please help me figure this out?

Thanks alot!
Reply With Quote
  #6  
Old 9th September 2007, 19:55
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,744 Times in 2,577 Posts
Default

Quote:
Originally Posted by goitalone
I made a domain test subdomain name with A record at freedns (CNAME wouln't work)

gay.sda-n-friends.com

I added this to Apache:

<VirtualHost *:80>
# ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /gay
ServerName gay.sda-n-friends.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

I made a folder for a new site.
That site is working for me (or should I see different content?).
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #7  
Old 9th September 2007, 20:42
goitalone goitalone is offline
Junior Member
 
Join Date: Sep 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I finally managed to figure it out, thanks!

I still have to figure out how to use .htaccess commands etc. for, if nothing more, to gain some extra knowledge.

Can I make subdomain.domain disguised as something else other than ending with my actual domains name?

Any advice or commands that you could mention of the top of your head that could be useful for .htsccess? I dunno, like maybe explin rewrite a bit to me?
Reply With Quote
  #8  
Old 10th September 2007, 20:11
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,744 Times in 2,577 Posts
Default

Quote:
Originally Posted by goitalone
Any advice or commands that you could mention of the top of your head that could be useful for .htsccess? I dunno, like maybe explin rewrite a bit to me?
I think the best is to take a look here: http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #9  
Old 10th September 2007, 21:57
goitalone goitalone is offline
Junior Member
 
Join Date: Sep 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
 
Default

Alright cool thanks!
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to enable Mod Rewrite AngelDrago Installation/Configuration 9 10th August 2007 23:20
how to make an htaccess Jonathan Installation/Configuration 4 7th November 2006 16:50
install Net::DNS chrno Installation/Configuration 4 5th September 2006 17:01
ispconfig and mambo shajazzi Installation/Configuration 70 28th March 2006 19:29
FC3 Perfect Installation Make Errors solderboy HOWTO-Related Questions 3 2nd October 2005 16:55


All times are GMT +2. The time now is 23:58.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.