LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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 07-30-2007, 02:50 PM   #1
mysql_connect
Member
 
Registered: Jul 2005
Distribution: Slackware 13.37 / Slackware64 13.37
Posts: 35

Rep: Reputation: 0
mod_rewrite: redirect depending on subdomain


Any idea how do I redirect depending on subdomain, for example:

domain.com
www.domain.com

I want them to redirect to www.domain.com/mainpage and:

customer1.domain.com
customer2.domain.com
.
.
.
etc

redirected to www.domain.com/customers.
 
Old 08-01-2007, 06:23 AM   #2
rizhun
Member
 
Registered: Jun 2005
Location: England
Distribution: Ubuntu, SLES, AIX
Posts: 268

Rep: Reputation: 47
I'm no re-write pro, but try something like:

Code:
RewriteLog "/var/log/httpd/rewrite.log"
RewriteLogLevel 9

RewriteCond     %{HTTP_HOST}       ^www\.domain\.com$
RewriteCond     %{HTTP_HOST}       ^domain\.com$
RewriteRule     ^(.+)              http://www.domain.com/mainpage   [NE,L,R]

RewriteCond     %{HTTP_HOST}       ^www\.customer(.+)\.domain\.com$
RewriteCond     %{HTTP_HOST}       ^customer(.+)\.domain\.com$
RewriteRule     ^(.+)              http://www.domain.com/customers   [NE,L,R]
Then you can have a look at the rewrite.log and figure the rest out.

Hope this helps.

Last edited by rizhun; 08-01-2007 at 06:24 AM.
 
  


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
View Depending Programs bigalexe Linux - Newbie 5 11-26-2006 10:07 AM
SVGALIB permissions different depending on kernel 2.4 or 2.6? gargamel Slackware 0 09-06-2006 08:08 PM
mod_rewrite, simple directory redirect? xconspirisist Linux - Software 3 12-20-2005 08:22 AM
Debian packet depending kara_lahana Debian 2 11-26-2005 12:44 PM
I can't compile any QT depending C++ application! Paulo Ges Programming 1 04-17-2003 04:11 PM


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