[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

htaccess help

Posted on 2012-08-17
2
Medium Priority
?
542 Views
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. "dev.domain.com") bypass these rules?

Urgent! Thanks.

htaccess-example.txt
0
Comment
Question by:sjl570
2 Comments
 
LVL 26

Accepted Solution

by:
arober11 earned 2000 total points
ID: 38307690
Hi

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 ^(.*)$ http://domain.com/$1 [R=301,L]

Open in new window


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

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

Open in new window

0
 

Author Comment

by:sjl570
ID: 38317414
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!
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
The title says it all. Writing any type of PHP Application or API code that provides high throughput, while under a heavy load, seems to be an arcane art form (Black Magic). This article aims to provide some general guidelines for producing this typ…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses

872 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