Solved

Redirecting mobile devices with .htaccess breaks CSS

Posted on 2012-03-17
2
546 Views
Last Modified: 2012-03-18
Hey Experts,

I am trying to redirect mobile devices using the following code:

RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
RewriteCond %{HTTP_HOST} !^halfoffdrinks.com/staging/mobile/
RewriteRule ^(.*)$ http://www.halfoffdrinks.com/staging/mobile/ [L,R=302]

Open in new window


It works great but it seems to also be redirecting my CSS calls or something?  The CSS breaks when I have that code in my .htaccess file.  If I remove it, the CSS works again.  Can someone please help me out?

Thank you!!
0
Comment
Question by:halfoffdrinks
2 Comments
 
LVL 43

Accepted Solution

by:
ravenpl earned 500 total points
ID: 37734567
Maybe You should exclude the css files from redirecting?
Like You already excluding the
> RewriteCond %{HTTP_HOST} !^halfoffdrinks.com/staging/mobile/
Add
RewriteCond %{REQUEST_URI} !\.css$
0
 

Author Comment

by:halfoffdrinks
ID: 37736319
Thanks ravenpl!  Adding:

RewriteCond %{REQUEST_URI} !\.css$

Open in new window


... did the trick!  Works great now :)  Thanks a lot!
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Join & Write a Comment

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…
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

758 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