htaccess help

Posted on 2012-08-17
Last Modified: 2012-08-21
I inherited a website that uses an htaccess file that's simply over my head...

I have a development environment setup in a subdomain, but it appears that all requests are getting re-directed back to the main directory. How can I setup an exclusion for my subdomain so that all development requests (e.g. "") bypass these rules?

Urgent! Thanks.

Question by:sjl570
    LVL 26

    Accepted Solution


    Add your sub-domain to the following rule:

    # Additional condition
    RewriteCond %{HTTP_HOST} !^DEV-SUB-DOMAIN\.domain\.com [NC] 
    RewriteCond %{HTTP_HOST} !^domain\.com [NC] 
    RewriteRule ^(.*)$$1 [R=301,L]

    Open in new window

    Then strip or replace with http://%{HTTP_HOST} all the strings from the RewriteRule lines e.g.

    RewriteRule ^login/ [L,R=301]
    RewriteRule ^login/     /Security/login [L,R=301]
    # Or Alternitively
    RewriteRule ^login/     http://%{HTTP_HOST}/Security/login [L,R=301]

    Open in new window


    Author Comment

    I'm no expert, but it looks like this should work. We're coming across some strange cache-related issues that are confusing the situation, so I can't verify whether this solves the problem. A work in progress... I appreciate your time - and hopefully this will help others in the same situation. Thanks!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
    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 …
    Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
    The viewer will learn how to count occurrences of each item in an array.

    737 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

    21 Experts available now in Live!

    Get 1:1 Help Now