LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 06-08-2006, 10:54 AM   #1
rlprofessional
LQ Newbie
 
Registered: Jun 2006
Posts: 10

Rep: Reputation: 0
Apache URL issue - will redirect help...


I have the following forum.mydomian.com/forum and forum.mydomain.com/blog they both work and take you to the site.

However, I want to use forum.mydomain.com and blog.mydomain.com to advertise to the world. Can I redirect these urls' to the above without the user knowing?

Help - new to Apache
 
Old 06-08-2006, 02:23 PM   #2
LuggerHouse
Member
 
Registered: May 2004
Location: Montreal,QC,Canada
Distribution: Fedora Core 7
Posts: 208

Rep: Reputation: 30
Sure you can... Use virtual domains in your apache config.

Here is a sample:
Code:
<VirtualHost *:80>
        ServerName forum
        ServerAlias forum.mydomain.com 
        DocumentRoot /var/www/html/forum/
</VirtualHost>

<VirtualHost *:80>
        ServerName blog
        ServerAlias blog.mydomain.com 
        DocumentRoot /var/www/html/blog/</VirtualHost>
Hope that helps!
 
Old 06-12-2006, 07:33 PM   #3
rlprofessional
LQ Newbie
 
Registered: Jun 2006
Posts: 10

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by LuggerHouse
Sure you can... Use virtual domains in your apache config.

Here is a sample:
Code:
<VirtualHost *:80>
        ServerName forum
        ServerAlias forum.mydomain.com 
        DocumentRoot /var/www/html/forum/
</VirtualHost>

<VirtualHost *:80>
        ServerName blog
        ServerAlias blog.mydomain.com 
        DocumentRoot /var/www/html/blog/</VirtualHost>
Hope that helps!

Now each one of them goes to the forum website... do I have to change something in the DNS.
 
Old 06-13-2006, 05:24 AM   #4
LuggerHouse
Member
 
Registered: May 2004
Location: Montreal,QC,Canada
Distribution: Fedora Core 7
Posts: 208

Rep: Reputation: 30
Quote:
Originally Posted by rlprofessional
Now each one of them goes to the forum website... do I have to change something in the DNS.
You have to change the way you are going to your site:

Forum:
forum.mydomian.com/

Blog:
blog.mydomain.com/

Like this, the subdomain rules tells the server in what directory to go.

Good Luck!
 
Old 06-14-2006, 12:53 PM   #5
rlprofessional
LQ Newbie
 
Registered: Jun 2006
Posts: 10

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by LuggerHouse
You have to change the way you are going to your site:

Forum:
forum.mydomian.com/

Blog:
blog.mydomain.com/

Like this, the subdomain rules tells the server in what directory to go.

Good Luck!

I used the code and when I go to forum.mydomain.com - I get the proper forum website. however, when I go to blogs.mydomain.com. it take me to the fourms website.

If i put the blogs "virtual" statement first in the code it still does not work. I have DNS pointing the same IP to forum.mydomain.com and blogs.mydomain.com.

Seem strange to me
 
Old 06-14-2006, 01:55 PM   #6
LuggerHouse
Member
 
Registered: May 2004
Location: Montreal,QC,Canada
Distribution: Fedora Core 7
Posts: 208

Rep: Reputation: 30
Can you please post that part of your config file ??

thanks
 
Old 06-16-2006, 07:03 AM   #7
rlprofessional
LQ Newbie
 
Registered: Jun 2006
Posts: 10

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by LuggerHouse
Can you please post that part of your config file ??

thanks
#<VirtualHost forum.mydomain.com:80>
# ServerName forum
# ServerAlias forum.mydomain.com
# DocumentRoot /var/www/html/forum/
#</VirtualHost>

#<VirtualHost blogs.mydomain.com:80>
# ServerName blogs
# ServerAlias blogs.mydomain.com
# DocumentRoot /var/www/html/blogs/
#</VirtualHost>


If I use the above - and restart httpd - I get an error indicating

Starting httpd: [Fri Jun 16 03:50:09 2006] [warn] VirtualHost forum.mydomain.com:80 overlaps with VirtualHost blogs.mydomain.com:80, the first has precedence,perhaps you need a NameVirtualHost directive

When I use *:80 and restart httpd - I get this error inidicating

Starting httpd: [Fri Jun 16 03:53:02 2006] [warn] _default_ VirtualHost overlap on port 80, the first has precedence

Thanks for all of your help.
 
Old 06-16-2006, 07:28 AM   #8
LuggerHouse
Member
 
Registered: May 2004
Location: Montreal,QC,Canada
Distribution: Fedora Core 7
Posts: 208

Rep: Reputation: 30
Hello

I forgot a little part... you also have to change NameVirtualHost *:80 ...

have a look at http://www.linuxquestions.org/questi...ad.php?t=20190

Good luck!

LuggerHouse
 
Old 06-16-2006, 11:15 AM   #9
rlprofessional
LQ Newbie
 
Registered: Jun 2006
Posts: 10

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by LuggerHouse
Hello

I forgot a little part... you also have to change NameVirtualHost *:80 ...

have a look at http://www.linuxquestions.org/questi...ad.php?t=20190

Good luck!

LuggerHouse

Thanks LuggerHouse...

It is working fine...

I'm through with Windows !!!

Thanks again
 
Old 06-16-2006, 12:43 PM   #10
LuggerHouse
Member
 
Registered: May 2004
Location: Montreal,QC,Canada
Distribution: Fedora Core 7
Posts: 208

Rep: Reputation: 30
Talking

Quote:
Originally Posted by rlprofessional
I'm through with Windows !!!
Happy to head that!!

Linux ROCKS!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache URL redirect problem kdogksu Linux - Networking 2 03-26-2005 03:22 PM
Virtual Host Redirect Issue DigiDave Linux - Software 1 10-23-2003 02:40 PM
ip redirect issue loser122 Linux - Networking 1 09-30-2003 02:54 PM
URL Redirect (with Masking) BxBoy General 0 03-11-2003 10:44 PM
Apache Virtual URL Redirect nxny Linux - Software 0 07-19-2002 03:36 PM


All times are GMT -5. The time now is 12:37 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration