[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Rewrite rule

Posted on 2011-09-30
1
Medium Priority
?
332 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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 …
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses
Course of the Month14 days, 17 hours left to enroll

649 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