LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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, 09: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 03:26 AM.
 
Old 06-16-2003, 07: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 07:37 AM.
 
Old 06-16-2003, 07: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, 02: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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:27 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
Open Source Consulting | Domain Registration