Solved

mod_rewrite rule on HTTP_HOST

Posted on 2014-04-30
1
244 Views
Last Modified: 2014-05-15
We are trying to capture any request that comes into our Apache server with a specific word in the domain and re-direct it to a specific page.

We currently have the following:

RewriteCond %{HTTP_HOST}   ^(.*)\.hydrochroma\.(.*)$ [NC]
RewriteRule ^/(.*)         http://dev.cp.com [R=301,L]

Basically we want anything with hydrochroma to be re-directed. The above rule traps everything and re-directs.

Any feedback will begreatly appreciated.
0
Comment
Question by:Jorge Fraser
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 50

Accepted Solution

by:
Steve Bink earned 500 total points
ID: 40034661
You can simplify the rule a bit:
RewriteCond %{HTTP_HOST} hydrochroma [NC]
RewriteRule ^/?.* http://dev.cp.com [R=301,L]

Open in new window

Really, it should work as-is.  Can you light up your RewriteLog, and paste the entries for a single attempt?
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question