LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-15-2011, 08:46 AM   #1
Vimuth
Member
 
Registered: Sep 2009
Posts: 59

Rep: Reputation: 15
How to redirect to a different site in apache


Dear Gentleman,

Greetings!!

I have httpd server installed and I need to do redirect all the requests from clients thats start with a http://abc.*.* on to http://www.xyz.com. I know this has to be done with Rewrite conditions but Im at a loss coming up with the right condition. PLease help out gentleman. Im in a real big rush.

Note that this site doesnt have any virtual hosts configured. Currenlty I only can access the apache test page.


REgards
V
 
Old 02-15-2011, 09:10 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,217
Blog Entries: 1

Rep: Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070
You're right about mod_rewrite. The following should do:
Code:
RewriteEngine on

RewriteCond %{HTTP_HOST} ^abc\.
RewriteRule (.*) http://www.xyz.com
Regards

Last edited by bathory; 02-15-2011 at 09:16 AM.
 
Old 02-16-2011, 03:17 AM   #3
sneakyimp
Senior Member
 
Registered: Dec 2004
Posts: 1,056

Rep: Reputation: 78
You'll need to make sure that apache has the mod_rewrite module. The code bathory offered would go in the apache configuration file -- or in a conf file in the conf.d directory which is included by apache automatically.
 
Old 02-23-2011, 07:11 AM   #4
Vimuth
Member
 
Registered: Sep 2009
Posts: 59

Original Poster
Rep: Reputation: 15
Dear Mr Bathroy,

Thank you so very much for your guidance Sir. It worked like a charm. Please forgive me for taking such a long time to reply since I was sick. Thank you very much for your advice too Mr.Sneakyimp. All the best


Regards
Vimuth
 
  


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 site redirects using what rule? foo.site.com -> www.site.com/foo LaughingBoy Linux - Server 2 04-16-2009 10:51 PM
How to redirect some sites to othere site in my network bhargavbhai Linux - Networking 2 08-13-2008 05:47 AM
How can i redirect a site? ZAMO Linux - Software 5 07-06-2007 03:03 AM
redirect site from apache to tomcat carlainz Linux - Server 1 12-09-2006 04:41 AM
no trailing slash -> apache redirect to microsoft site? SerfurJ Linux - Software 6 03-15-2005 07:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:07 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