• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 335
  • Last Modified:

host name for forum

hello,
I have a forum on my server like domain.com/forum
how can I do so that when ever someone types
forum.domain.com it goes to domain.com/forum
can someone help me ?
thanks
0
Sabrin
Asked:
Sabrin
  • 7
  • 6
  • 5
1 Solution
 
Robin HickmottSoftware DeveloperCommented:
You need to contact whoever is in control of your domain and get them to point a sub domain of forum.domain.com at your web servers IP address. (it may already be set there as a default).

you will then need to get whoever handles your web server to set up records so that forum.domain.com points at the correct folder. Most providers will supply a control panel for setting up sub domains have a look though the options.
0
 
periwinkleCommented:
rhickmott is quite correct - there are two aspects to getting the subdomain pointing to your forum.

(1) First, you must set up DNS entries so that forum.domain.com resolves ot the webserver in question

(2) Secondly, you must instruct the web server to understand how to respond.

There are multiple ways of accomplishing(2), however.  You could install your forum into an entirely diffrerent hosting space from domain.com; or you could simply set up forum.domin.com to forward to domain.com/forum via a permanent redirecton.
0
 
SabrinAuthor Commented:
yeah, of course i know that I have to do those two things
the reason why im here is because I want to know how!
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
SabrinAuthor Commented:
the forum.domain.com points to the ip already so i need just the second one!
0
 
periwinkleCommented:
Sabrin - I certainly didn't mean to insult your intelligence - not everyone would realize those two things.

Easiest method would be to add a entry to your httpd.conf file which is:

<VirtualHost xxx.xxx.xxx.xxx:80> (or whatever convention you use)
ServerName forum.domain.com
Redirect Permanent / http://domain.com/forum 
</VirtualHost>

Then restart the apache webserver.

If you do not have access to the httpd.conf file, but are able to use mod_rewrite and overrides are enabled, write back, and we'll show you the entries for the .htaccess file that you'd need to do a conditional mod_rewrite.
0
 
Robin HickmottSoftware DeveloperCommented:
Well its quite an extensive question.

You can read up all day on DNS and still scratch the surface ditto Apache.

I guess the key questions are

Do you own your own web server or is it hosted by someone else?
What web server are you using?
Who did you register your domain with?

Normally most domain registers have a control panel where you can log in to control the Naming Records of your domain. If you look you will probably have a record saying something along the lines of

-          domain.com     A     xxx.xxx.xxx.xxx
www    domain.com    A    xxx.xxx.xxx.xxx
mail      domain.com   mx 10  xxx.xxx.xx.xxx

You need to add another "A" record for the sub domain forums and point them at your "WWW" or "-" IP Address. This will handle the domain side. If you have hosting with someone and they registered your domain they may do this for you but you will also need to speak to them to get the sub domain hosted. if its your own server you will need to edit the config files again we will need to know what server to assist. Some hosting companies have their own control panel allowing you to set up new sub domains easily and are relativity idiot proof.


0
 
SabrinAuthor Commented:
periwinkle I dont have access to the httpd.conf
0
 
Robin HickmottSoftware DeveloperCommented:
Ok no problem :) if the sub domain is already set up and im guessing Apache then basically use periwinkles code above.

If you don't have any current virtual hosts you might need to set up Name Based Hosting.

Right at the bottom of your HTTPD.CONF file do


NameVirtualHost *:80

<VirtualHost *:80>
     # Do Nothing ( Will Use Main Server Settings )
</VirtualHost>

<VirtualHost *:80>
      ServerName forum.domain.com
      Redirect Permanent / http://domain.com/forum 
</VirtualHost>

As periwinkle said you will need to change * to whatever ip/naming/port your using.
0
 
Robin HickmottSoftware DeveloperCommented:
Ok then you will need to handle the redirect via .htaccess or get your hosting provider to set up the domain redirect for you.

In your root add a file called .htaccess with the following.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^forum\.mysite\.com$ [NC]
RewriteRule ^(.*)$ http://www.mysite.com/forum/$1 [R=301,L]
0
 
periwinkleCommented:
Without access to the httpd.conf, you can try using mod_rewrite.  In the file called .htaccess in the root of your website (which you can create if it doesn't exist), place the following lines:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^forum\.domain\.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/forum$ [R=301]

This basically will look for a the domain name being forum.domain.com and force it to redirect to domain.com/forum.

0
 
periwinkleCommented:
rhickmott's is a little bit better - that will pass any additional lines, like:

http://forum.domain.com/something will go to http://domain.com/forum/something.
0
 
SabrinAuthor Commented:
ok I tried with both and none of them are working!!
0
 
SabrinAuthor Commented:
everytime I type forum.domain.com
is like if I was just going to the ip http://67.12.23.34
0
 
periwinkleCommented:
are you receiving an error of any sort, or is it just going to the front page of domain.com?

Is there any information in your access_log or error_log?
0
 
periwinkleCommented:
RE: everytime I type forum.domain.com
is like if I was just going to the ip http://67.12.23.34

Is 67.12.23.34 the IP address that domain.com and forum.domain.com points to?  Is it the proper site at domain.com, or is it a different site?

If it is the same IP address as domain.com, but you aren't receiving the domain.com website, then there are multiple virtual servers set up at that IP address, and you will need to get your ISP to set up a subhosting account for you.
0
 
Robin HickmottSoftware DeveloperCommented:
How long ago did you set up the pointer for forums?

When you change DNS records it takes about 24 hours to 48 hours to update successfully. If its been longer than this then they this wont be an issue.

try a ping on forums.domain.com and see what IP it resolves to and what response you get. If it replys with the right IP then what do you get when you goto http://forums.domain.com/ if its your normal document root then the code *should* work unless your hosting company have disallowed it. If it doesent resolve to anything then you will prob have to contact your hopst to get them to set-up the sub domain for you.


0
 
SabrinAuthor Commented:
I sent an icq to the admin with your code and he said ok !
thanks
0
 
periwinkleCommented:
Glad to have helped!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 7
  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now