Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 07-30-2007, 02:50 PM   #1
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:

I want them to redirect to and:

redirected to
Old 08-01-2007, 06:23 AM   #2
Registered: Jun 2005
Location: England
Distribution: Ubuntu, SLES, AIX
Posts: 268

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

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

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

RewriteCond     %{HTTP_HOST}       ^www\.customer(.+)\.domain\.com$
RewriteCond     %{HTTP_HOST}       ^customer(.+)\.domain\.com$
RewriteRule     ^(.+)       [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.


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 > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:56 PM.

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