Solved

Rewrite rule

Posted on 2011-09-30
1
330 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
[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 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

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.
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

688 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