Solved

mod_rewrite rule on HTTP_HOST

Posted on 2014-04-30
1
231 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
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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

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

Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

863 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now