Solved

Rewrite rule

Posted on 2011-09-30
1
324 Views
Last Modified: 2012-06-21
A previous web developer decided ot redirect all domain.com URLs to www.domain.com. Now, we need to have a subdomain called members.domain.com and forums.domain.com, but that won't work because of the way the rewire rule is written. Further, I cannot change the rewrite rule, because it will break SEO.

I need to specifically allow members.domain.com and forums.domain.com (i.e., the rewrite rule should ignore those subdomains, but re-direct everything else).

How do I re-write that?

Here's the .htaccess file we're working with:

 
RewriteCond %{HTTP_HOST} !^www\.domain\.com$ [NC]
RewriteRule .? http://www.domain.com%{REQUEST_URI} [R=301,L]

Open in new window

0
Comment
Question by:DrDamnit
1 Comment
 
LVL 32

Accepted Solution

by:
DrDamnit earned 0 total points
ID: 36892981
Figured it out:
 
RewriteCond %{HTTP_HOST} !^www\.domain\.com$ [NC] [AND]
RewriteCond %{HTTP_HOST} !^forums\.domain\.com$ [NC] [AND]
RewriteCond %{HTTP_HOST} !^members\.domain\.com$ [NC]
RewriteRule .? http://www.domain.com%{REQUEST_URI} [R=301,L]

Open in new window

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

It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
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.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

803 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