Solved

Rewrite rule

Posted on 2011-09-30
1
321 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
Comment Utility
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATEā€¦
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secureā€¦
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

772 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

10 Experts available now in Live!

Get 1:1 Help Now