LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 06-15-2003, 10:47 PM   #1
CrazyToon
LQ Newbie
 
Registered: Jun 2003
Posts: 21

Rep: Reputation: 0
Exclamation Apache rewrite question


I would like to redirect any url which doesn't have www.domain.org to www.domain.org.

For example: http://google.com --> http://www.google.com
but, http://test.google.com --> http://test.google.com

I hope that make sense, and i hope there are apache guru's out there who can help me. I need this solution for multiple domains so not google.com specific solution.

Thanks in advance.

Last edited by CrazyToon; 06-16-2003 at 04:26 AM.
 
Old 06-16-2003, 08:35 AM   #2
bentman78
Member
 
Registered: Mar 2003
Location: Washington DC, USA
Distribution: Redhat
Posts: 212

Rep: Reputation: 30
Are you trying to host several different sites on the same sever without multiple I.Ps? Is so you must create virtual hosts for each site and then add the I.P address and host name to your etc/hosts file. A virtual host looks like this (add these to your httpd.conf file, change the domain names to your sites names, change the document root to the directories you wish:

<VirtualHost *>
ServerName www.domain.com
DocumentRoot /www/domain
</VirtualHost>

<VirtualHost *>
ServerName www.otherdomain.com
DocumentRoot /www/otherdomain
</VirtualHost>


After you have done that, add these names to your hosts file, and give them the same I.P. adress. For instance if the name is www.domain.com and the i.p adress is 192.168.1.1, your hosts file would look like this

192.168.1.1 www.domain.com
192.168.1.1 www.theotherdomain.com

Apache will route to the proper site depending on the URL, you can host several different sites on the same box with the same I.P address. kind of like Host Headers in IIS.

Last edited by bentman78; 06-16-2003 at 08:37 AM.
 
Old 06-16-2003, 08:58 AM   #3
stickman
Senior Member
 
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
Check out the URL Rewriting Guide on the Apache website. It's in the docs section for the 1.X branch.
 
Old 06-17-2003, 03:00 PM   #4
CrazyToon
LQ Newbie
 
Registered: Jun 2003
Posts: 21

Original Poster
Rep: Reputation: 0
Thanks for responses.

I am using mass virtual hosting format. and i tried reading the url rewriting guide but its beyond my skillset unfortunately.
 
  


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
Need help with Apache rewrite rules?? latino Programming 0 12-24-2004 03:09 AM
apache proxy server rewrite urls slackwarefan Linux - Software 0 10-19-2004 08:58 PM
Help me make this rewrite rule in Apache ganninu Linux - General 8 01-07-2004 09:30 AM
apache mod rewrite Robert0380 Linux - Software 5 07-31-2003 05:42 PM
Apache Rewrite Not Working mikeyt_333 Linux - General 1 05-20-2003 06:00 PM


All times are GMT -5. The time now is 06:48 AM.

Main Menu
Advertisement
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